How to use the wtforms.SubmitField function in WTForms

To help you get started, we’ve selected a few WTForms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kizniche / Mycodo / mycodo / mycodo_flask / forms / forms_conditional.py View on Github external
refractory_period = DecimalField(
        lazy_gettext('Refractory Period (seconds)'),
        widget=NumberInput(step='any'))
    start_offset = DecimalField(
        lazy_gettext('Start Offset (seconds)'),
        widget=NumberInput(step='any'))
    condition_type = SelectField(
        choices=[('', TRANSLATIONS['select_one']['title'])] + CONDITIONAL_CONDITIONS)
    add_condition = SubmitField(lazy_gettext('Add Condition'))
    action_type = SelectField(
        choices=[('', TRANSLATIONS['select_one']['title'])] + FUNCTION_ACTIONS)
    add_action = SubmitField(lazy_gettext('Add Action'))
    activate_cond = SubmitField(TRANSLATIONS['activate']['title'])
    deactivate_cond = SubmitField(TRANSLATIONS['deactivate']['title'])
    test_all_actions = SubmitField(lazy_gettext('Test All Actions'))
    delete_conditional = SubmitField(TRANSLATIONS['delete']['title'])
    save_conditional = SubmitField(TRANSLATIONS['save']['title'])
    order_up = SubmitField(TRANSLATIONS['up']['title'])
    order_down = SubmitField(TRANSLATIONS['down']['title'])


class ConditionalConditions(FlaskForm):
    conditional_id = StringField(
        'Conditional ID',widget=widgets.HiddenInput())
    conditional_condition_id = StringField(
        'Conditional Condition ID', widget=widgets.HiddenInput())

    # Measurement
    input_id = StringField('Input ID', widget=widgets.HiddenInput())
    measurement = StringField(TRANSLATIONS['measurement']['title'])
    max_age = IntegerField(
        TRANSLATIONS['max_age']['title'],
github jonaprieto / flask-ponywhoosh / flask_ponywhoosh / form.py View on Github external
except_field (StringField): Fields you do not want to include in the search results.
      fields (StringField): Fields, separated by comma,  where you want to search.
      models (StringField): Models, separated by comma, where you want to search.
      query (StringField): What you want to search.
      something (BooleanField): Option to literal search first, but in case there are no results available, it performs a search with wild_cards.
      submit (SubmitField): Button to submit the form.
      wildcards (BooleanField): Checkbox
  """

  add_wildcards = BooleanField('Add Wildcards', default=True)
  except_field  = StringField('Except in Fields')
  fields        = StringField('Fields')
  models        = StringField('Models')
  query         = StringField('What are you looking for?')
  something     = BooleanField('Something')
  submit        = SubmitField('Submit')
github PininQ / Flask_movie_project / app / home / forms.py View on Github external
}
    )


class CommentForm(FlaskForm):
    content = TextAreaField(
        label="内容",
        validators=[
            DataRequired("请输入内容!"),
        ],
        description="内容",
        render_kw={
            "id": "input_content"
        }
    )
    submit = SubmitField(
        "提交评论",
        render_kw={
            "class": "btn btn-success",
            "id": "btn-sub"
        }
github Rolight / EduVideoShare / app / main / forms.py View on Github external
# -*- coding: utf-8 -*-
#coding=utf-8

from flask_wtf import Form
from wtforms import StringField, PasswordField, BooleanField, SubmitField, SelectField
from wtforms.validators import Required, Length, Email, Regexp, EqualTo
from wtforms import ValidationError
from ..models import User, Tag

# 用户资料编辑器,用来修改密码
class EditProfileForm(Form):
    password = PasswordField(u'密码', validators=[Required(), Length(6, 18), EqualTo('password2', message=u'密码与确认密码必须相同')])
    password2 = PasswordField(u'确认密码', validators=[Required()])
    submit = SubmitField(u'保存修改')
github nutechsoftware / alarmdecoder-webapp / ad2web / settings / forms.py View on Github external
class EthernetConfigureForm(Form):
    ethernet_device = HiddenField()
    connection_type = RadioField(u'Connection Type', choices=[('static', 'Static'), ('dhcp', 'DHCP')], default='dhcp', coerce=str)
    ip_address = TextField('IP Address', [IPAddress('Invalid IP Address')])
    gateway = TextField('Default Gateway', [IPAddress('Invalid Gateway IP Format')])
    netmask = TextField('Subnet Mask', [IPAddress('Invalid Subnet IP Format')])
    submit = SubmitField(u'Save')
    cancel = ButtonField(u'Cancel', onclick="location.href='/settings/host'")

class SwitchBranchForm(Form):
    remotes_web = SelectField(u'Origin alarmdecoder-webapp', coerce=str)
    branches_web = SelectField(u'Branch', coerce=str)
    remotes_api = SelectField(u'Origin alarmdecoder api', coerce=str)
    branches_api = SelectField(u'Branch', coerce=str)
    submit = SubmitField(u'Checkout')

class EmailConfigureForm(Form):
    mail_server = TextField(u'Email Server', [Required(), Length(max=255)], description=u'ex: smtp.gmail.com')
    port = IntegerField(u'Server Port', [Required(), NumberRange(1, 65535)], description=u'ex: 25 for normal or 587 for TLS')
    tls = BooleanField(u'Use TLS?', default=False)
    auth_required = BooleanField(u'Authentication Required?',default=False)
    username = TextField(u'Username', [Optional(), Length(max=255)], description=u'Email Username')
    password = PasswordField(u'Password', [Optional(), Length(max=255)], description=u'Email Password')
    default_sender = TextField(u'From Email', [Required(), Length(max=255)], default='root@alarmdecoder', description=u'Emails will come from this address')
    submit = SubmitField(u'Save')

class UPNPForm(Form):
    internal_port = IntegerField(u'Internal Port', [Required()], default=443, description=u'Internal Port to Forward To')
    external_port = IntegerField(u'External Port', [Required()], default=random.randint(1200,60000), description=u'External Port to map to Internal Port')

    submit = SubmitField(u'Save')
github DataDog / gello / app / controllers / subscriptions / forms.py View on Github external
return self._repo_id

    def get_error_message(self):
        return self._error_message


class UpdateForm(FlaskForm):
    """Form for updating an existing subscription."""
    issue_autocard = BooleanField('Issue Autocard')
    pull_request_autocard = BooleanField('Pull Request Autocard')
    submit = SubmitField('Update')


class DeleteForm(FlaskForm):
    """Form for deleting an existing subscription."""
    submit = SubmitField('Delete')
github nyaadevs / nyaa / nyaa / forms.py View on Github external
is_comment_locked = BooleanField('Lock Comments')

    information = StringField('Information', [
        Length(max=255, message='Information must be at most %(max)d characters long.')
    ])
    description = TextAreaField('Description', [
        Length(max=10 * 1024, message='Description must be at most %(max)d characters long.')
    ])

    submit = SubmitField('Save Changes')


class DeleteForm(FlaskForm):
    delete = SubmitField("Delete")
    ban = SubmitField("Delete & Ban")
    undelete = SubmitField("Undelete")
    unban = SubmitField("Unban")


class BanForm(FlaskForm):
    ban_user = SubmitField("Delete & Ban and Ban User")
    ban_userip = SubmitField("Delete & Ban and Ban User+IP")
    unban = SubmitField("Unban")

    _validator = DataRequired()

    def _validate_reason(form, field):
        if form.ban_user.data or form.ban_userip.data:
            return BanForm._validator(form, field)

    reason = TextAreaField('Ban Reason', [
        _validate_reason,
github Raibows / NCEPU-CS-COURSES / DatabaseExp / BookManagementSystem / app / main / forms.py View on Github external
)
    register_user_password = PasswordField(
        '密码',
        validators=[
            DataRequired(),
            regexp(regex=user_password_regex, flags=0, message='密码必须为数字或英文6到12位')
        ]
    )
    register_user_password_confirm = PasswordField(
        '确认密码',
        validators=[
            DataRequired(),
            EqualTo('register_user_password', message='两次输入密码必须一致')
        ]
    )
    register_submit = SubmitField('注册')

class Login_form(FlaskForm):
    login_user_id = StringField(
        '学号',
        validators=[
            DataRequired(),
            regexp(regex=user_id_regex, flags=0, message='学号必须为6位整数')
        ]
    )
    login_user_password = PasswordField(
        '密码',
        validators=[
            DataRequired(),
            regexp(regex=user_password_regex, flags=0, message='密码必须为数字或英文6到12位')
        ]
    )
github kizniche / Mycodo / mycodo / flaskforms.py View on Github external
("0", lazy_gettext(u'Off'))
        ],
        validators=[DataRequired()]
    )
    pwm_hertz = IntegerField(lazy_gettext(u'Frequency (Hertz)'))
    pwm_library = SelectField(
        lazy_gettext(u'Library'),
        choices=[
            ("pigpio_any", lazy_gettext(u'Any Pin (<= 40 kHz)')),
            ("pigpio_hardware", lazy_gettext(u'Hardware Pin (<= 30 MHz)'))
        ],
        validators=[DataRequired()]
    )
    save = SubmitField(lazy_gettext(u'Save'))
    delete = SubmitField(lazy_gettext(u'Delete'))
    order_up = SubmitField(lazy_gettext(u'Up'))
    order_down = SubmitField(lazy_gettext(u'Down'))
    pwm_duty_cycle_on = DecimalField(
        lazy_gettext(u'Duty Cycle (%)'),
        validators=[Optional()]
    )
    on_submit = SubmitField(lazy_gettext(u'Turn On'))


#
# Remote Admin add servers
#

class RemoteSetup(FlaskForm):
    remote_id = IntegerField('Remote Host ID', widget=widgets.HiddenInput())
    host = StringField(
        lazy_gettext(u'Domain or IP Address'),
github scanse / sweep-3d-scanner / webapp / app.py View on Github external
import sys

# App config.
DEBUG = True
app = Flask(__name__)
app.config.from_object(__name__)
app.config['SECRET_KEY'] = '7d441f27d441f27567d441f2b6176a'


class FileManager(Form):
    scan_file = SelectField(
        label='Scan:',
        choices=[],
        validators=[validators.required()]
    )
    download = SubmitField(label='Download')
    delete = SubmitField(label='Delete')


class ScanSettingsForm(Form):
    """Docstring"""
    motor_speed = SelectField(
        label='Motor Speed:',
        choices=[('1', '1Hz'), ('2', '2Hz'), ('3', '3Hz')],
        validators=[validators.required()]
    )

    sample_rate = SelectField(
        label='Sample Rate:',
        choices=[('500', '500Hz'), ('750', '750Hz'), ('1000', '1000Hz')],
        validators=[validators.required()]
    )