How to use the wtforms.BooleanField 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 / flaskforms.py View on Github external
message=lazy_gettext(u"Number of minutes to display of past "
                                 u"measurements.")
        )]
    )
    refresh_duration = IntegerField(
        lazy_gettext(u'Refresh (seconds)'),
        render_kw={"placeholder": lazy_gettext(u"Refresh duration")},
        validators=[validators.NumberRange(
            min=1,
            message=lazy_gettext(u"Number of seconds to wait between acquiring"
                                 u" any new measurements.")
        )]
    )
    enable_navbar = BooleanField(lazy_gettext(u'Enable Navbar'))
    enable_export = BooleanField(lazy_gettext(u'Enable Export'))
    enable_range = BooleanField(lazy_gettext(u'Enable Range Selector'))
    Submit = SubmitField(lazy_gettext(u'Create'))


class GaugeAdd(FlaskForm):
    graph_type = StringField('Type', widget=widgets.HiddenInput())
    name = StringField(
        lazy_gettext(u'Name'),
        render_kw={"placeholder": lazy_gettext(u"Name")},
        validators=[DataRequired()]
    )
    sensor_ids = SelectMultipleField(lazy_gettext(u'Measurement'))
    width = IntegerField(
        lazy_gettext(u'Width'),
        validators=[validators.NumberRange(
            min=1,
            max=12
github foozmeat / moa / moa / forms.py View on Github external
from flask_wtf import FlaskForm
from wtforms import BooleanField, RadioField, StringField
from wtforms.validators import DataRequired, Email, Length

from moa.models import CON_XP_DISABLED, CON_XP_ONLYIF, CON_XP_UNLESS


class SettingsForm(FlaskForm):
    enabled = BooleanField('Crossposting Enabled?')
    conditional_posting = RadioField('Conditional crossposting', choices=[
        (CON_XP_DISABLED, 'Disabled'),
        (CON_XP_ONLYIF, "Crosspost only if hashtag #moa or #xp is present"),
        (CON_XP_UNLESS, 'Crosspost unless hashtag #nomoa or #noxp is present'),
    ])

    post_to_twitter = BooleanField('Post Public toots to Twitter?')
    post_private_to_twitter = BooleanField('Post Private toots to Twitter?')
    post_unlisted_to_twitter = BooleanField('Post Unlisted toots to Twitter?')
    post_boosts_to_twitter = BooleanField('Post Boosts to Twitter?')
    split_twitter_messages = BooleanField('Split long toots on Twitter?')
    post_sensitive_behind_link = BooleanField('Link toot with warning if there are sensitive images?')
    sensitive_link_text = StringField('', validators=[Length(min=1, message="Warning can't be empty")])
    remove_cw = BooleanField("Remove toot content warning?")

    post_rts_to_mastodon = BooleanField('Post RTs to Mastodon?')
    post_quotes_to_mastodon = BooleanField('Post quoted tweets to Mastodon?')
    post_to_mastodon = BooleanField('Post tweets to Mastodon?')
    toot_visibility = RadioField('Toot visibility', choices=[
        ('public', 'Public'),
        ('private', "Private"),
        ('unlisted', 'Unlisted'),
    ])
github byceps / byceps / webapp / byceps / blueprints / shop_admin / forms.py View on Github external
from wtforms import BooleanField, DecimalField, IntegerField, SelectField, \
    StringField, TextAreaField

from ...util.l10n import LocalizedForm


class ArticleCreateForm(LocalizedForm):
    description = StringField('Beschreibung')
    price = DecimalField('Stückpreis', places=2)
    tax_rate = DecimalField('Steuersatz', places=3)
    quantity = IntegerField('Anzahl verfügbar')


class ArticleUpdateForm(ArticleCreateForm):
    max_quantity_per_order = IntegerField('Maximale Anzahl pro Bestellung')
    not_directly_orderable = BooleanField('nur indirekt bestellbar')
    requires_separate_order = BooleanField('muss separat bestellt werden')


class ArticleAttachmentCreateForm(LocalizedForm):
    article_to_attach_id = SelectField('Artikel')
    quantity = IntegerField('Anzahl')


class OrderCancelForm(LocalizedForm):
    reason = TextAreaField('Begründung')
github saurabhshri / ccextractor-web / mod_dashboard / forms.py View on Github external
'.vfw', '.vfz', '.vgz', '.vid', '.video', '.viewlet', '.viv', '.vivo', '.vlab', '.vob', '.vp3', '.vp6', '.vp7', '.vpj',
                          '.vro', '.vs4', '.vse', '.vsp', '.w32', '.wcp', '.webm', '.wlmp', '.wm', '.wmd', '.wmmp', '.wmv', '.wmx', '.wot', '.wp3',
                          '.wpl', '.wtv', '.wve', '.wvx', '.xej', '.xel', '.xesc', '.xfl', '.xlmv', '.xmv', '.xvid', '.y4m', '.yog', '.yuv', '.zeg',
                          '.zm1', '.zm2', '.zm3', '.zmv', 'bin', 'raw'])


class UploadForm(FlaskForm):
    accept = 'video/mp4, video/x-m4v, video/*, .bin, .raw, video/MP2T, .ts'

    file = FileField('Select your file', [DataRequired(message='No file selected.')], render_kw={'accept': accept})

    parameters = TextAreaField('Parameters')
    ccextractor_version = SelectField('CCExtractor Version', [DataRequired(message='Select Version')], coerce=str)
    platforms = SelectField('Platform', [DataRequired(message='Select platform')], coerce=str)
    remark = TextAreaField('Remarks')
    start_processing = BooleanField('Start Processing', default=True)
    submit = SubmitField('Upload file')

    @staticmethod
    def validate_file(form, field):
        filename, extension = os.path.splitext(field.data.filename)
        if len(extension) > 0:
            if extension not in ALLOWED_EXTENSIONS:  # or guessed_extension not in ALLOWED_EXTENSIONS:
                raise ValidationError('Extension not allowed')


class NewJobForm(FlaskForm):
    parameters = TextAreaField('Parameters')
    ccextractor_version = SelectField('CCExtractor Version', [DataRequired(message='Select Version')], coerce=str)
    platforms = SelectField('Platform', [DataRequired(message='Select platform')], coerce=str)
    remark = TextAreaField('Remarks')
    submit = SubmitField('Submit')
github jhpyle / docassemble / docassemble_webapp / docassemble / webapp / develop.py View on Github external
cancel = SubmitField(word('Cancel'))
    delete = SubmitField(word('Delete'))

class GoogleDriveForm(FlaskForm):
    folder = SelectField(word('Folder'))
    submit = SubmitField(word('Save'))
    cancel = SubmitField(word('Cancel'))

class OneDriveForm(FlaskForm):
    folder = SelectField(word('Folder'))
    submit = SubmitField(word('Save'))
    cancel = SubmitField(word('Cancel'))

class GitHubForm(FlaskForm):
    shared = BooleanField(word('Access shared repositories'))
    orgs = BooleanField(word('Access organizational repositories'))
    save = SubmitField(word('Save changes'))
    configure = SubmitField(word('Configure'))
    unconfigure = SubmitField(word('Disable'))
    cancel = SubmitField(word('Back to profile'))

class TrainingForm(FlaskForm):
    the_package = HiddenField()
    the_file = HiddenField()
    the_group_id = HiddenField()
    show_all = HiddenField()
    submit = SubmitField(word('Save'))
    cancel = SubmitField(word('Cancel'))

class TrainingUploadForm(FlaskForm):
    usepackage = RadioField(word('Use Package'))
    jsonfile = FileField(word('JSON file'))
github Galts-Gulch / avarice / webconfigure.py View on Github external
class Database(Form):
  archive = BooleanField(
      'Archive', description='Save all data in Archive.sqlite in database Path.',
      default=ast.literal_eval(config['Database']['Archive']))
  store = BooleanField('Store All',
                       description='Never delete any data. Avarice normally only keeps the needed data.',
                       default=ast.literal_eval(config['Database']['Store All']))
  debug = BooleanField(
      'Debug', default=ast.literal_eval(config['Database']['Debug']))
  path2 = TextField('Path', description='Relative path to database directory',
                    default=config['Database']['Path'])
  database_submit = SubmitField('Save')


class Grapher(Form):
  enabled = BooleanField('Enabled', description='Record graphs. Requires pygal and lxml',
                         default=ast.literal_eval(config['Grapher']['Enabled']))
  stime = BooleanField('Show Time Instead of Candles', default=ast.literal_eval(
      config['Grapher']['Show Time']))
  path3 = TextField('Path', description='Relative path to chart directory.',
                    default=config['Grapher']['Path'])
  theme = SelectField('Theme', default='DarkSolarized', choices=[
      ('DarkSolarized', 'Dark Solarized'),
      ('LightSolarized', 'Light Solarized'), ('Light', 'Light'),
      ('Clean', 'Clean'), ('Red Blue', 'Red Blue'),
      ('DarkColorized', 'Dark Colorized'),
      ('LightColorized', 'Light Colorized'),
      ('Turquoise', 'Turquoise'), ('LightGreen', 'Light Green'),
      ('DarkGreen', 'Dark Green'), ('DarkGreenBlue', 'Dark Green Blue'),
      ('Blue', 'Blue')])
  look = TextField('Max Lookback', description='Max candles to show on x-axis',
                   default=config['Grapher']['Max Lookback'])
github FORTH-ICS-INSPIRE / artemis / frontend / webapp / views / admin / forms / __init__.py View on Github external
from flask_wtf import FlaskForm
from wtforms import BooleanField
from wtforms import SubmitField


class CheckboxForm(FlaskForm):
    monitor = BooleanField("Monitor", default=False)
    detector = BooleanField("Detector", default=False)
    mitigator = BooleanField("Mitigator", default=False)
    submit = SubmitField("Save")
github afourmy / eNMS / eNMS / services / miscellaneous / rest_call.py View on Github external
form_type = HiddenField(default="RestCallService")
    has_targets = BooleanField("Has Target Devices", default=True)
    call_type = SelectField(
        choices=(
            ("GET", "GET"),
            ("POST", "POST"),
            ("PUT", "PUT"),
            ("DELETE", "DELETE"),
            ("PATCH", "PATCH"),
        )
    )
    rest_url = SubstitutionField()
    payload = JsonSubstitutionField()
    params = DictSubstitutionField()
    headers = DictSubstitutionField()
    verify_ssl_certificate = BooleanField("Verify SSL Certificate")
    timeout = IntegerField(default=15)
    username = StringField()
    password = PasswordField()
    groups = {
        "Main Parameters": {
            "commands": [
                "has_targets",
                "call_type",
                "rest_url",
                "payload",
                "params",
                "headers",
                "verify_ssl_certificate",
                "timeout",
                "username",
                "password",
github spz-signup / spz-signup / src / spz / spz / forms / __init__.py View on Github external
[validators.Optional()]
    )
    mail_courses = SelectMultipleField(
        'Kurse',
        [validators.DataRequired('Kurs muss angegeben werden')],
        coerce=int
    )
    mail_sender = SelectField(
        'Absender',
        [validators.DataRequired('Absender muss angegeben werden')],
        coerce=int
    )
    only_active = BooleanField(
        'Nur an Aktive'
    )
    only_have_to_pay = BooleanField(
        'Nur an nicht Bezahlte'
    )
    only_waiting = BooleanField(
        'Nur an Wartende'
    )
    attachments = MultipleFileField(
        'Anhang',
        [validators.MultiFilesFileSizeValidator(0, app.config['MAIL_MAX_ATTACHMENT_SIZE'])]
    )

    def __init__(self, *args, **kwargs):
        super(NotificationForm, self).__init__(*args, **kwargs)
        # See SignupForm for this "trick"
        self.mail_courses.choices = cached.all_courses_to_choicelist()
        self.mail_sender.choices = self._sender_choices()
github afourmy / eNMS / eNMS / services / unix / unix_shell_script_service.py View on Github external
auto_find_prompt=run.auto_find_prompt,
                strip_prompt=run.strip_prompt,
                strip_command=run.strip_command,
            )
            if return_code != "0":
                break
        return {
            "return_code": return_code,
            "result": result,
            "success": return_code == "0",
        }


class UnixShellScriptForm(NetmikoForm):
    form_type = HiddenField(default="unix_shell_script_service")
    enable_mode = BooleanField("Run as root using sudo")
    source_code = StringField(
        widget=TextArea(),
        render_kw={"rows": 15},
        default=(
            "#!/bin/bash\n"
            "# The following example shell script returns"
            " 0 for success; non-zero for failure\n"
            "directory_contents=`ls -al /root`  # Needs privileged mode\n"
            "return_code=$?\n"
            "if [ $return_code -ne 0 ]; then\n"
            "    exit $return_code  # Indicating Failure\n"
            "else\n"
            '    echo -e "$directory_contents"\n'
            "    exit 0  # Indicating Success\n"
            "fi\n"
        ),