Exemplo n.º 1
0
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 FormWithValidations(FormidableForm):
     text = fields.CharField(validators=[MinLengthValidator(4)])
     integer = fields.NumberField(validators=[GTEValidator(42.4)])
Exemplo n.º 3
0
        class MyForm(FormidableForm):

            mynumber = fields.NumberField(
                label='number', validators=[validators.GTValidator(5)]
            )
 class TestintegerField(FormidableForm):
     """ Test integer """
     integer = fields.NumberField()
Exemplo n.º 5
0
 class MyForm(FormidableForm):
     number_children = fields.NumberField(label='Your Children Number')