Accepting a tuple for validation argument.
This commit is contained in:
parent
da57572409
commit
e196e229cd
@ -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…
x
Reference in New Issue
Block a user