#37245 new Bug

ArrayField model validators stop validation at first failing array item

Reported by: Chris Owned by:
Component: contrib.postgres Version: 5.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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).

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top