本文整理汇总了Python中model.User.get_user_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_user_by_id方法的具体用法?Python User.get_user_by_id怎么用?Python User.get_user_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.User
的用法示例。
在下文中一共展示了User.get_user_by_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_user_by_id [as 别名]
def index():
"""Homepage."""
quote = pick_quote()
if session.get('logged_in_user') is None:
print "***************", "No logged in user"
user = None
else:
print "****************", "there is a user logged in", session.get('logged_in_user')
user = User.get_user_by_id(session.get('logged_in_user'))
return render_template("lotr_map.html", quote=quote, user=user)
示例2: high_scores
# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_user_by_id [as 别名]
def high_scores():
"""Page with leaderboard scores."""
top10 = Session.query.filter_by().order_by(desc(Session.meditation_high_score)).all()
users = [User.get_user_by_id(user.user_id) for user in top10]
# users = User.query.all()
# query to get email to pass into top 10
print top10
return render_template("leaderboard.html", top10=top10, users=users)
示例3: display_edit_profile_options
# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_user_by_id [as 别名]
def display_edit_profile_options(userid):
"""Get user info and display it so user can edit."""
editeduser = User.get_user_by_id(userid)
return render_template("edit_profile.html", editeduser=editeduser)
示例4: user_profile
# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_user_by_id [as 别名]
def user_profile(user_id):
"""Show details about a user."""
user = User.get_user_by_id(user_id)
return render_template('user_detail.html', user=user)