本文整理汇总了Python中app.user.models.User.get_user_by_username方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_user_by_username方法的具体用法?Python User.get_user_by_username怎么用?Python User.get_user_by_username使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.user.models.User
的用法示例。
在下文中一共展示了User.get_user_by_username方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_followers
# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user_by_username [as 别名]
def user_followers(username = None):
user = User.get_user_by_username(username)
if user != None and user.is_active():
return render_template('users/user_followers.html',
Follow = Follow,
user = user,
title = user.profile.name + "'s Followers")
abort(404)
示例2: user_following
# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user_by_username [as 别名]
def user_following(username = None):
user = User.get_user_by_username(username)
if user != None and user.is_active():
return render_template('users/user_following.html',
Follow = Follow,
user = user,
title = user.profile.name + " is following these pages.")
abort(404)
示例3: user_thanks_given
# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user_by_username [as 别名]
def user_thanks_given(username = None):
user = User.get_user_by_username(username)
if user != None and user.is_active():
return render_template('users/user_thanks_given.html',
Follow = Follow,
user = user,
thanks = user.thanks_given.order_by(desc(Thank.date_registered)).all(),
title = 'Thanks Given by ' + user.profile.name)
abort(404)
示例4: user_thanks_received
# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user_by_username [as 别名]
def user_thanks_received(username = None):
user = User.get_user_by_username(username)
if user != None and user.is_active():
return render_template('users/user_thanks_received.html',
Follow = Follow,
ThankReceivedByUser = ThankReceivedByUser,
user = user,
thanks = user.thanks_received\
.filter(ThankReceivedByUser.status == ThankReceivedByUserStatusChoices.VISIBLE)\
.order_by(desc(Thank.date_registered)).all(),
title = 'Thanks Received by ' + user.profile.name)
abort(404)
示例5: user_thanks
# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user_by_username [as 别名]
def user_thanks(username = None):
user = User.get_user_by_username(username)
if user != None and user.is_active():
thanks = Thank.query.join(ThankReceivedByUser)\
.filter(Thank.status != ThankStatusChoices.DELETED,
ThankReceivedByUser.status != ThankReceivedByUserStatusChoices.DELETED,
ThankReceivedByUser.status != ThankReceivedByUserStatusChoices.HIDDEN)\
.filter(or_(Thank.giver_id == user.id,
ThankReceivedByUser.receiver_id == user.id))\
.order_by(desc(Thank.date_registered))\
.all()
return render_template('users/user_thanks.html',
thanks = thanks,
user = user,
title = user.profile.name + "'s Thanks")
abort(404)