mirror of
https://github.com/django/django.git
synced 2025-08-21 11:10:38 +00:00
[1.8.x] Fixed #24373 -- Added run_validators to ArrayField.
Thanks to DavidMuller for the report.
Backport of c490e410af
from master
This commit is contained in:
parent
3886338c1d
commit
b6ef67d752
2 changed files with 21 additions and 1 deletions
|
@ -139,6 +139,18 @@ class ArrayField(Field):
|
|||
code='nested_array_mismatch',
|
||||
)
|
||||
|
||||
def run_validators(self, value):
|
||||
super(ArrayField, self).run_validators(value)
|
||||
for i, part in enumerate(value):
|
||||
try:
|
||||
self.base_field.run_validators(part)
|
||||
except exceptions.ValidationError as e:
|
||||
raise exceptions.ValidationError(
|
||||
string_concat(self.error_messages['item_invalid'], ' '.join(e.messages)),
|
||||
code='item_invalid',
|
||||
params={'nth': i},
|
||||
)
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
defaults = {
|
||||
'form_class': SimpleArrayField,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue