当前位置: 首页>>代码示例>>Python>>正文


Python User.get_user_by_username方法代码示例

本文整理汇总了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)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:10,代码来源:views.py

示例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)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:10,代码来源:views.py

示例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)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:11,代码来源:views.py

示例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)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:14,代码来源:views.py

示例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)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:18,代码来源:views.py


注:本文中的app.user.models.User.get_user_by_username方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。