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


Python flask_wtf.FlaskForm方法代码示例

本文整理汇总了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
    ) 
开发者ID:alphagov,项目名称:notifications-admin,代码行数:27,代码来源:styleguide.py

示例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) 
开发者ID:muicss,项目名称:flaskapp,代码行数:14,代码来源:auth.py

示例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. 
开发者ID:etesync,项目名称:etesync-dav,代码行数:11,代码来源:webui.py

示例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')) 
开发者ID:etesync,项目名称:etesync-dav,代码行数:8,代码来源:webui.py

示例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')) 
开发者ID:etesync,项目名称:etesync-dav,代码行数:14,代码来源:webui.py

示例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 
开发者ID:jarun,项目名称:buku,代码行数:7,代码来源:views.py


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