-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3169841
commit 41ae297
Showing
10 changed files
with
125 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,52 @@ | ||
from validation import ServiceForm | ||
from validation.custom import CommaSeparatedField | ||
from wtforms import IntegerField, StringField | ||
from wtforms.validators import DataRequired, NumberRange | ||
from wtforms import DecimalField, IntegerField, StringField | ||
from wtforms.validators import DataRequired, Optional, NumberRange | ||
|
||
|
||
class MovieListForm(ServiceForm): | ||
genres = CommaSeparatedField( | ||
StringField( | ||
'genres', | ||
validators=[ | ||
DataRequired(message='The genres field is required.') | ||
] | ||
) | ||
validators=[Optional()] | ||
), | ||
default=['Drama'] | ||
) | ||
|
||
years = CommaSeparatedField( | ||
StringField( | ||
IntegerField( | ||
'years', | ||
validators=[ | ||
DataRequired(message='The years field is required.') | ||
] | ||
) | ||
validators=[Optional()] | ||
), | ||
default=['1979, 1989, 1999, 2009'] | ||
) | ||
|
||
score = DecimalField( | ||
label='score', | ||
validators=[ | ||
Optional(), | ||
NumberRange(min=5.0, max=9.0, message='The score must be between 5.0 and 9.0.') | ||
], | ||
default=8.0 | ||
) | ||
|
||
num_votes = IntegerField( | ||
label='num_votes', | ||
validators=[ | ||
Optional(), | ||
NumberRange( | ||
min=5000, | ||
max=25000, | ||
message='The number of votes must be between 5000 and 25000.' | ||
) | ||
], | ||
default=25000 | ||
) | ||
|
||
page = IntegerField( | ||
label='page', | ||
validators=[ | ||
DataRequired(), | ||
DataRequired('The page number is required.'), | ||
NumberRange(min=1, message='The page number must be at least 1.') | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters