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


Python User.save方法代码示例

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


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

示例1: signup_post

# 需要导入模块: from daimaduan.models.base import User [as 别名]
# 或者: from daimaduan.models.base.User import save [as 别名]
def signup_post():
    form = SignupForm(request.forms)
    if form.validate():
        user = User()
        form.populate_obj(user)
        user.save()
        login.login_user(user.id)
        send_confirm_email(app.config, user.email)
        return redirect('/active_email')
    return {'form': form, 'token': request.csrf_token}
开发者ID:david-xie,项目名称:daimaduan.com,代码行数:12,代码来源:users.py

示例2: manage

# 需要导入模块: from daimaduan.models.base import User [as 别名]
# 或者: from daimaduan.models.base.User import save [as 别名]
def manage():
    form = UserInfoForm(request.forms)
    if form.validate():
        if request.user:
            request.user.username = form.username.data
            return redirect('/')
        else:
            user = User(email=form.email.data, username=form.username.data,
                        is_email_confirmed=True)
            user.save()
            login.login_user(str(user.id))
            session = get_session(request)
            if 'email' in session:
                del(session['email'])
            return redirect('/')
    return {'form': form, 'token': request.csrf_token}
开发者ID:david-xie,项目名称:daimaduan.com,代码行数:18,代码来源:users.py

示例3: manage

# 需要导入模块: from daimaduan.models.base import User [as 别名]
# 或者: from daimaduan.models.base.User import save [as 别名]
def manage():
    form = UserInfoForm(request.form)
    if form.validate():
        if current_user.is_authenticated:
            current_user.user.username = form.username.data
            return redirect('/')
        else:
            user = User(email=form.email.data, username=form.username.data,
                        is_email_confirmed=True)
            user.save()
            user_mixin = LoginManagerUser(user)
            login_user(user_mixin)
            if 'email' in session:
                del(session['email'])
            return redirect('/')
    return render_template('users/manage.html',
                           form=form)
开发者ID:martincheng,项目名称:daimaduan.com,代码行数:19,代码来源:users.py

示例4: signup

# 需要导入模块: from daimaduan.models.base import User [as 别名]
# 或者: from daimaduan.models.base.User import save [as 别名]
def signup():
    form = SignupForm()
    if request.method == 'GET':
        return render_template('users/signup.html',
                               form=form)
    else:
        if form.validate_on_submit():
            user = User()
            form.populate_obj(user)
            user.save()
            bookmark = Bookmark(user=user,
                                title=u"%s 的收藏夹" % user.username,
                                is_default=True)
            bookmark.save()
            user_mixin = LoginManagerUser(user)
            login_user(user_mixin)
            send_confirm_email(current_app.config, user.email)
            return redirect(url_for('site_app.index'))
        return render_template('users/signup.html',
                               form=form)
开发者ID:myideaway1024,项目名称:daimaduan.com,代码行数:22,代码来源:sites.py

示例5: finish_signup

# 需要导入模块: from daimaduan.models.base import User [as 别名]
# 或者: from daimaduan.models.base.User import save [as 别名]
def finish_signup():
    form = UserInfoForm(request.form)
    if form.validate():
        if current_user.is_authenticated:
            current_user.user.username = form.username.data
            return redirect('/')
        else:
            user = User(email=form.email.data, username=form.username.data,
                        is_email_confirmed=True)
            user.save()
            bookmark = Bookmark(user=user,
                                title=u"%s 的收藏夹" % user.username,
                                is_default=True)
            bookmark.save()
            user_mixin = LoginManagerUser(user)
            login_user(user_mixin)
            flash(u"登录成功", category='info')
            if 'email' in session:
                del (session['email'])
            return redirect('/')
    return render_template('users/finish_signup.html',
                           form=form)
开发者ID:DoubleCiti,项目名称:daimaduan.com,代码行数:24,代码来源:sites.py


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