#16986: Model.clean cannot report errors on individual fields
-----------------------------+-------------------------------------
Reporter: davidfstr | Owner: davidfstr
Type: New feature | Status: new
Component: Forms | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------
Comment (by davidfstr):
Replying to [comment:14 carljm]:
> regular form validation and model validation should behave the same in
terms of how `ValidationError` can be used
OK. I'll investigate making this work for `ModelForm.clean()` and
`Form.clean()`.
Replying to [comment:14 carljm]:
> I think the values in that dictionary should similarly be allowed to be
either a single message or a list of messages, not required to be a list.
My approach here would be to accept such a dictionary as input from the
constructor and then normalize it internally to always be a dictionary of
message-lists. This means that the dictionary obtained from a
`ValidationError` would not necessarily be equivalent to the dictionary
passed in its constructor. I don't see this as a problem in practice, and
it avoids having normalization code called in multiple places.
--
Ticket URL: <https://code.djangoproject.com/ticket/16986#comment:15>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.