views.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:to-vendendo 作者: anapaulagomes 项目源码 文件源码
def register_view(self):
        form = RegistrationForm(request.form)
        if helpers.validate_form_on_submit(form):
            user = User()

            form.populate_obj(user)
            user.password = generate_password_hash(form.password.data)

            db.session.add(user)
            db.session.commit()

            login.login_user(user)
            return redirect(url_for('.index'))

        link = '<p>Already have an account? <a href="' \
            + url_for('.login_view') + '">Click here to log in</a></p>'
        self._template_args['form'] = form
        self._template_args['link'] = link
        return super(AuthenticationView, self).index()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号