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


Python User.get_user方法代码示例

本文整理汇总了Python中app.user.models.User.get_user方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_user方法的具体用法?Python User.get_user怎么用?Python User.get_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app.user.models.User的用法示例。


在下文中一共展示了User.get_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: follows_followed_unfollow

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user [as 别名]
def follows_followed_unfollow(followed_id):
    user = User.get_user(followed_id)
    if user != None and not user.is_deleted():
        follow = Follow.get_follow_by_follower_and_followed(g.user.id, user.id)
        if follow != None:
            follow.make_deleted()
            db.session.add(follow)
            db.session.commit()
        return redirect(url_for('user_thanks', username = user.username))
    abort(404)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:12,代码来源:views.py

示例2: follows_followed_follow

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user [as 别名]
def follows_followed_follow(followed_id):
    user = User.get_user(followed_id)
    if user != None and not user.is_deleted():
        if not Follow.is_following_by_follower_and_followed(g.user.id, user.id):
            follow = Follow(g.user.id, user.id)
            db.session.add(follow)
            db.session.commit()
            emails.follower_notification(g.user, user)
        return redirect(url_for('user_thanks', username = user.username))
    abort(404)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:12,代码来源:views.py

示例3: validate

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user [as 别名]
    def validate(self):
        rv = Form.validate(self)
        if not rv:
            return False

        all_receivers = []
        for x in self.receivers.data.split(','):
            for y in x.split(' '):
                all_receivers.append(y.lower())

        all_receivers = list(set(all_receivers))
        all_receivers = filter(None, all_receivers)

        valid_receivers = {'emails':[],'users':[],'public_pages':[]}
        for receiver in all_receivers:
            if functions.is_email(receiver):
                email = EmailModel.get_email_by_email(receiver)
                if email == None:
                    email = EmailModel(email = receiver)
                    db.session.add(email)
                    db.session.commit()
                valid_receivers['emails'].append(email)

            elif receiver[:1] == 'u' and functions.is_integer(receiver[1:]):
                user = UserModel.get_user(int(receiver[1:]))
                if user != None:
                    valid_receivers['users'].append(user)

            elif receiver[:2] == 'pp' and functions.is_integer(receiver[2:]):
                public_page = PublicPageModel.get_public_page(int(receiver[2:]))
                if public_page != None:
                    valid_receivers['public_pages'].append(public_page)

        for key in valid_receivers:
            if valid_receivers[key] != []:
                self.receivers.data = valid_receivers
                return True

        self.receivers.errors.append('No valid receivers were entered.')
        return False

    #     if self.media.data != None and functions.is_image_type(self.media.data.filename):
    #         return True
    #     self.media.errors.append('Image files only.')
    #     return False
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:47,代码来源:forms.py

示例4: load_user

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user [as 别名]
def load_user(id):
    return User.get_user(int(id))
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:4,代码来源:views.py

示例5: users_user_thanks_received

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user [as 别名]
def users_user_thanks_received(user_id = None):
    try:
        return redirect(url_for('user_thanks_received', username = User.get_user(user_id).username))
    except:
        abort(404)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:7,代码来源:views.py

示例6: users_user_following

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import get_user [as 别名]
def users_user_following(user_id = None):
    try:
        return redirect(url_for('user_following', username = User.get_user(user_id).username))
    except:
        abort(404)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:7,代码来源:views.py


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