本文整理汇总了Python中flask_wtf.FlaskForm方法的典型用法代码示例。如果您正苦于以下问题:Python flask_wtf.FlaskForm方法的具体用法?Python flask_wtf.FlaskForm怎么用?Python flask_wtf.FlaskForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_wtf
的用法示例。
在下文中一共展示了flask_wtf.FlaskForm方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: styleguide
# 需要导入模块: import flask_wtf [as 别名]
# 或者: from flask_wtf import FlaskForm [as 别名]
def styleguide():
if not current_app.config['SHOW_STYLEGUIDE']:
abort(404)
class FormExamples(Form):
username = StringField(u'Username')
password = PasswordField(u'Password', [validators.required()])
code = StringField('Enter code')
message = TextAreaField(u'Message')
file_upload = FileField('Upload a CSV file to add your recipients’ details')
sms = "Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax"
form = FormExamples()
form.message.data = sms
form.validate()
template = SMSPreviewTemplate({'content': sms, 'template_type': 'sms'})
return render_template(
'views/styleguide.html',
form=form,
template=template
)
示例2: email_verification_request
# 需要导入模块: import flask_wtf [as 别名]
# 或者: from flask_wtf import FlaskForm [as 别名]
def email_verification_request():
"""GET|POST /email-verification-request: handle email verification requests
"""
u = g.user
form = FlaskForm()
if form.validate_on_submit():
send_verification_email(u)
fn = '/auth/email-verification-request-followup.html'
return render_template(fn, email=u.email)
return render_template('/auth/email-verification-request.html', form=form)
示例3: logout
# 需要导入模块: import flask_wtf [as 别名]
# 或者: from flask_wtf import FlaskForm [as 别名]
def logout():
form = FlaskForm(request.form)
if form.validate_on_submit():
logout_user()
return redirect(url_for('login'))
# FIXME: hack to kill server after generation.
示例4: shutdown
# 需要导入模块: import flask_wtf [as 别名]
# 或者: from flask_wtf import FlaskForm [as 别名]
def shutdown():
form = FlaskForm(request.form)
if form.validate_on_submit():
return shutdown_response()
return redirect(url_for('login'))
示例5: certgen
# 需要导入模块: import flask_wtf [as 别名]
# 或者: from flask_wtf import FlaskForm [as 别名]
def certgen():
if request.method == 'GET':
return redirect(url_for('account_list'))
form = FlaskForm(request.form)
if form.validate_on_submit():
generate_cert()
macos_trust_cert()
return shutdown_response()
return redirect(url_for('account_list'))
示例6: scaffold_form
# 需要导入模块: import flask_wtf [as 别名]
# 或者: from flask_wtf import FlaskForm [as 别名]
def scaffold_form(self):
class CustomForm(FlaskForm): # pylint: disable=too-few-public-methods
name = wtforms.StringField(validators=[wtforms.validators.DataRequired()])
return CustomForm