#16986: Model.clean cannot report errors on individual fields
-----------------------------+------------------------------------
Reporter: davidfstr | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by davidfstr):
* needs_tests: 1 => 0
Comment:
Replying to [comment:4 carljm]:
> That said, I'm not sure initializing message_dict the way you suggest is
correct. `ValidationError` without a dict can be used from inside a
clean_field method to raise errors specific to that field, in which case
having a message_dict property auto-initialized using `__all__` seems
semantically wrong. Essentially `ValidationError` itself can in some cases
be agnostic as to which field its errors belong to, and that is determined
by context.
Interesting. I didn't realize that `ValidationError` could be used in that
way. I guess I haven't written any custom fields with their own validation
logic.
Anyway, I've update the patch with unit tests, now that I've figured out
how Django's unit tests work.
P.S. Apparently it wasn't sufficient to add myself to the CC list to
receive emails. I've now updated my Trac profile with my email address.
Hopefully I should now receive email updates. And be able to respond in a
more timely fashion.
--
Ticket URL: <https://code.djangoproject.com/ticket/16986#comment:6>
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.