Exemple #1
0
class QueryRadioSelectField(QuerySelectField):
    """
    Works the same as a QuerySelectField, except using radio buttons
    rather than a selectbox.

    Iterating over the field yields the radio subfields.
    """
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.RadioInput()
Exemple #2
0
class RadioField(SelectField):
    """
    Like a SelectField, except displays a list of radio buttons.

    Iterating the field will produce subfields (each containing a label as
    well) in order to allow custom rendering of the individual radio fields.
    """
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.RadioInput()
Exemple #3
0
class RadioBoxField(fields.SelectField):
    """
    A multiple-select, except displays a list of checkboxes.

    Iterating the field will produce subfields, allowing custom rendering of
    the enclosed checkbox fields.
    """
    widget = CheckboxGroup(inline=True)
    option_widget = widgets.RadioInput()
Exemple #4
0
class RadioBooleanField(RadioField):
    widget = InlineListWidget()
    option_widget = widgets.RadioInput()

    def process_formdata(self, valuelist):
        if 'False' in valuelist:
            self.data = False
        elif 'True' in valuelist:
            self.data = True
        else:
            self.data = False
Exemple #5
0
class CodeForm(Form):
    content = CodeMirrorField('content')
    file_name = fields.HiddenField('file_name')
    submit = fields.SubmitField('submit')
    theme = fields.SelectField('Theme', choices=theme_choice)
    mode = fields.SelectField('mode', choices=mode_choice)
    test_select = fields.SelectField(
        'test',
        choices=test_choice,
        option_widget=widgets.RadioInput(),
        widget=widgets.ListWidget(prefix_label=False))
Exemple #6
0
class EditUserRoleForm(FlaskForm):
    roles = MultiCheckboxField('roles', option_widget=widgets.RadioInput())
    submit = SubmitField('Submit')
Exemple #7
0
from functools import partial

from wtforms import BooleanField, validators, HiddenField, widgets, StringField, DateField, TextAreaField
from wtforms import SelectField as SelectFieldW
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms_alchemy import ModelFieldList

from dexter.forms import ModelForm, FormField, MultiCheckboxField, IntegerField, SelectField, RadioField, YesNoField, FloatField
from dexter.models import *  # noqa

QueryRadioField = partial(QuerySelectField,
                          widget=widgets.ListWidget(prefix_label=False),
                          option_widget=widgets.RadioInput())


class DocumentSourceForm(ModelForm):
    """ Form for editing a document source. """
    class Meta:
        model = DocumentSource
        only = ['name', 'quoted', 'photographed']
        field_args = {'name': {'label': 'Name'}}

    id = HiddenField('id', [validators.Optional()])
    deleted = HiddenField('deleted', default='0')
    person_id = IntegerField('person_id', widget=widgets.HiddenInput())

    named = BooleanField('The source is named', default=True)
    source_type = RadioField(
        'Type',
        default='person',
        choices=[['person', 'Adult'], ['child', 'Child'],
Exemple #8
0
class RadioButtonField(SelectField):
    """Radio button field"""
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.RadioInput()
Exemple #9
0
class CustomRadioField(CustomSelectField):

    pre_validate = lambda self, form: None
    widget = ListWidgetWithReset(prefix_label=False)
    option_widget = widgets.RadioInput()
Exemple #10
0
class QueryRadioField(QuerySelectField):
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.RadioInput()
Exemple #11
0
class CheckboxField(SelectField):
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.RadioInput()
class BooleanField(f.RadioField):
  widget = widgets.BooleanWidget()
  option_widget = w.RadioInput()
Exemple #13
0
class KRadioField(fields.SelectField):
    widget = KListWidget(html_tag='div', sub_tag='label', prefix_label=False)
    option_widget = widgets.RadioInput()