class Validation:
nickname = (
StringTypeValidator &
LengthValidator(21) &
AlphaNumericValidator
)
name = (
StringTypeValidator &
LengthValidator(24) &
NoNumbersValidator &
TitledValidator &
AlphaNumericValidator
)
city = (
StringTypeValidator &
LengthValidator(24) &
NoNumbersValidator &
(TitledValidator | CapitalizedValidator) &
AlphaNumericValidator
)
class User(Document):
nickname = StringField(validation=Validation.nickname)
name = StringField(validation=Validation.name)
city = StringField(required=False, validation=Validation.city)
User(
nickname='phantie',
name='Alex',
city='Odessa'
).validate()
-
Notifications
You must be signed in to change notification settings - Fork 0
reusable combinable composite field validators for mongoengine models
License
phantie/mongoengine-field-validation
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
reusable combinable composite field validators for mongoengine models