-
Notifications
You must be signed in to change notification settings - Fork 0
Nullable
Majid Ahmaditabar edited this page Dec 10, 2021
·
3 revisions
- The field under validation may be null.
data = {
"name": "",
"number": "a2",
}
rules = {
"name": ["nullable", "alpha"],
"number": ["nullable", "numeric"],
}
validate = PyValidations.make(data, rules)
name passed because is empty but number return error because not null and wrong number.
{
"failed": True,
"errors": {
'number': ['The number must be a number.']
}
}