當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。