本文整理匯總了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