尝试提交表单时出现此错误。我不确定是否没有值/未定义什么,并且正在寻找指导,因为追溯至少没有为我提供太多见识。第一次尝试运行该页面之前,我遇到了此错误,此问题已通过将form = form放入render_template的参数来解决。我认为问题出在views.py中,但是如果我缺少代码或其他任何内容,请告诉我。谢谢views.py@blueprint.route("register/")def register_page(): """Renders register site landing page.""" form = RegisterForm() return render_template('main/register.html', page_title="Register", form=form, media_types=current_app.config["ACCEPTED_" "MEDIA_TYPE"])@blueprint.route("register/", methods=['GET', 'POST'])def register(): """Renders register page.""" form = RegisterForm() if request.method == 'POST': if not form.validate_on_submit(): return render_template('main/register.html', page_title="Service Registration", form=form, form_success=False) # If company does not exist, create it if err: company, err = create_company(form.organization.data) if err: return render_template('main/register.html', page_title="Service Registration", form=form, form_success=False, message=err) if err: return render_template('main/register.html', page_title="Service Registration", form=form, form_success=False, message=err) if err: return render_template('main/register.html', page_title="Service Registration", form=form, form_success=False, message=err) else: success_msg = "Your ticket id is {}. You should receive an email with a link to your ticket." .format(ticket.get('id')) return render_template('main/register.html', page_title="Service Registration", form=form, form_success=True, message=success_msg) return render_template('main/register.html', page_title="Service Registration", form=form)
添加回答
举报
0/150
提交
取消