Accepting a tuple for validation argument.
This commit is contained in:
parent
da57572409
commit
e196e229cd
1 changed files with 1 additions and 1 deletions
|
|
@ -85,7 +85,7 @@ class BaseField(object):
|
|||
"""Perform validation on a value.
|
||||
"""
|
||||
if self.validation is not None:
|
||||
if isinstance(self.validation, list) and value not in self.validation:
|
||||
if (isinstance(self.validation, list) or isinstance(self.validation, tuple)) and value not in self.validation:
|
||||
raise ValidationError('Value not in validation list.')
|
||||
elif callable(self.validation) and not self.validation(value):
|
||||
raise ValidationError('Value does not match custom validation method.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue