Python wtforms.IntegerField() Examples

The following are 1 code examples of wtforms.IntegerField(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wtforms , or try the search function .
Example #1
Source File: reviewview.py    From radremedy with Mozilla Public License 2.0 6 votes vote down vote up
def scaffold_form(self):
        """
        Sets up the review form to ensure that the rating field
        behaves on a 1-5 scale.
        """
        form_class = super(ReviewView, self).scaffold_form()

        form_class.rating = IntegerField(
            review_column_labels['rating'],
            validators=[
                validators.Required(),
                validators.NumberRange(min=1, max=5)
            ]
        )

        form_class.staff_rating = IntegerField(
            review_column_labels['staff_rating'],
            validators=[
                validators.Optional(),
                validators.NumberRange(min=1, max=5)
            ]
        )

        form_class.intake_rating = IntegerField(
            review_column_labels['intake_rating'],
            validators=[
                validators.Optional(),
                validators.NumberRange(min=1, max=5)
            ]
        )

        return form_class