Esempio n. 1
0
 class MyForm(FormidableForm):
     first_name = fields.CharField(default='foo')
     last_name = fields.CharField(default='bar')
     origin = fields.ChoiceField(choices=(('fr', 'France'),
                                          ('en', 'England')))
     weapons = fields.ChoiceField(choices=(('gun', 'Gun'), ('sword',
                                                            'Sword')))
Esempio n. 2
0
        class MyForm(FormidableForm):

            radioinput = fields.ChoiceField(label=u'Apero ?',
                                            choices=(
                                                ('Yes', 'Oui'),
                                                ('No', 'Non'),
                                            ),
                                            widget=widgets.RadioSelect)
Esempio n. 3
0
class FormTest(FormidableForm):

    title = fields.TitleField(label='Jedi Onboarding')
    helptext = fields.HelpTextField(text='youhou')
    mytext = fields.CharField(label='Name', accesses={
        'padawan': 'EDITABLE', 'jedi': 'REQUIRED', 'jedi-master': 'HIDDEN',
        'human': 'EDITABLE',
    })
    dropdown = fields.ChoiceField(
        choices=(('tutu', 'toto'), ('foo', 'bar')),
        accesses={'jedi': 'EDITABLE'}
    )
Esempio n. 4
0
class DropdownConditionsTestForm(FormidableForm):
    main_dropdown = fields.ChoiceField(
        choices=(
            ('ab', 'AB'),
            ('b', 'B'),
            ('no_condition', 'No_condition')
        ),
        accesses={'padawan': constants.EDITABLE}
    )
    a = fields.CharField(
        accesses={'padawan': constants.EDITABLE})
    b = fields.CharField(
        accesses={'padawan': constants.EDITABLE})
    c = fields.CharField(
        accesses={'padawan': constants.EDITABLE})
 class DropDownForm(FormidableForm):
     main_dropdown = fields.ChoiceField(
         choices=(
             ('first', 'First'),
             ('second', 'Second'),
             ('third', 'Third'),
         ),
         accesses={'padawan': constants.EDITABLE})
     first_field = fields.CharField(
         accesses={'padawan': constants.EDITABLE})
     second_field = fields.CharField(
         accesses={'padawan': constants.EDITABLE})
     third_field = fields.CharField(
         accesses={'padawan': constants.EDITABLE})
     another_field = fields.CharField(
         accesses={'padawan': constants.EDITABLE})
class MyTestForm(FormidableForm):
    name = fields.CharField(label='Name', accesses={'jedi': 'REQUIRED'})
    birth_date = fields.DateField(
        label='Your Birth Date',
        validators=[
            validators.AgeAboveValidator(
                21, message='You cannot be a jedi until your 21'),
            validators.DateIsInFuture(False)
        ],
        accesses={'jedi': 'REQUIRED'},
    )
    out_date = fields.DateField(validators=[validators.DateIsInFuture(True)])
    weapons = fields.ChoiceField(choices=[('gun',
                                           'blaster'), ('sword',
                                                        'light saber')])
    salary = fields.NumberField(
        validators=[validators.GTValidator(0),
                    validators.LTEValidator(25)],
        accesses={
            'jedi': 'HIDDEN',
            'jedi-master': 'REQUIRED'
        })
 class TestRadioField(FormidableForm):
     radioinput = fields.ChoiceField(
         widget=widgets.RadioSelect,
         choices=(('yes', 'Yes'), ('no', 'No')),
     )
 class WithDropdown(FormidableForm):
     weapon = fields.ChoiceField(widget=widgets.SelectMultiple,
                                 choices=(('gun', 'Eagles'),
                                          ('sword', 'Excalibur')))
Esempio n. 9
0
 class MyForm(FormidableForm):
     mydropdown = fields.ChoiceField(label='Weapons', choices=(
         ('GUN', 'eagle'), ('SWORD', 'Andúril'))
     )