﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37244	Interaction between postgres ArrayField model field and ModelForm results in incomplete validation error messages	Chris		"The contrib.postgres model `ArrayField` uses the validator(s) of the base (model) field of the `ArrayField` to validate the items in the array. It catches the `ValidationError` exceptions, then prefixes them with its own prefix (""Item <x> in the array did not validate:"") and re-raises this exception with the `""item_invalid""` code.

`BaseModelForm` collects these model validation errors in the `_post_clean()` method, and passes them to `_update_errors()`. This last method replaces the message of a validation error if the code of that validation error also is in the form field's `error_messages` dict, before adding it to the form errors.

The problem here is of course that the helpful message from the model (i.e. ""Item <x> in the array did not validate: <reason from base field validator>"") gets replaced by only the prefix: ""Item <x> in the array did not validate:"", and this is what is then rendered as the error in the form, with the entire reason for the validation failure no longer shown.

This is not usually a problem if the ''model'' field also has a corresponding custom ''form'' field which has the same validators, because these are run first and should catch the same problems before the model validators are tried, and these are not subject to the same replace-validation-message-from-model-with-the-one-from-the-form mechanics.

"	Bug	new	Forms	5.2	Normal				Unreviewed	0	0	0	0	0	0
