[Django] #37245: ArrayField model validators stop validation at first failing array item

0 views
Skip to first unread message

Django

unread,
Aug 2, 2026, 6:14:17 PM (8 hours ago) Aug 2
to django-...@googlegroups.com
#37245: ArrayField model validators stop validation at first failing array item
-----------------------+--------------------------------------------
Reporter: Chris | Type: Bug
Status: new | Component: contrib.postgres
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------+--------------------------------------------
The validation of the `ArrayField` model field stops validation of the
array at the first element failing validation.

The provided form field classes instead continue validation and collect
all errors from all elements.

If only the model validation fails, then only the first failing element is
reported. This might happen if a custom `base_field` is used which does
not have a corresponding form field, or does not add its validators to the
form field, or just does some custom validation which is for whatever
reason not present or possible in the form, etc.

The model validation should produce the same results as the form
validation.

The `ArrayField` methods `validate()` and `run_validators()` methods
should not immediately re-raise a (prefixed) `ValidationError` but collect
the error into an `error_list`, continue with the rest of the array
elements, and at the end raise one `ValidationError` with the `error_list`
(if any errors occurred).
--
Ticket URL: <https://code.djangoproject.com/ticket/37245>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages