本文整理汇总了Python中app.user.models.User.view_user方法的典型用法代码示例。如果您正苦于以下问题:Python User.view_user方法的具体用法?Python User.view_user怎么用?Python User.view_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.user.models.User
的用法示例。
在下文中一共展示了User.view_user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user
# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import view_user [as 别名]
def user(username):
try:
other_user = User.get(User.username == username)
bio_form = BiographyForm()
user = User.get(User.id == current_user.get_id())
other_user_email = other_user.email
other_user_email_hash = gravatar_hash(other_user_email)
gravatar = "http://www.gravatar.com/avatar/{}?s=300".format(other_user_email_hash)
data = User.view_user(username)
is_pending = user.is_pending(username)
is_friend = user.is_friend(username)
if user.username == username:
own_page = True
else:
own_page = False
print("IS PENDING:", is_pending, "IS FRIEND:", is_friend)
return render_template("user.html", user=data, is_friend=is_friend, is_pending=is_pending, own_page=own_page, gravatar=gravatar, bio_form=bio_form)
except DoesNotExist:
return render_template("error.html", title="User does not exist.", description="Please make sure the url contains a valid username.")