Changes between Initial Version and Version 1 of Ticket #16986, comment 1
- Timestamp:
- Oct 5, 2011, 11:57:36 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16986, comment 1
initial v1 3 3 I'd call this a new feature rather than a bug, since it's never been documented anywhere that you can raise a dict-style `ValidationError` from `clean` to get errors associated with particular fields. That said, it's a useful feature and one that I've wanted before, and the implementation is trivial and non-invasive. 4 4 5 Rather than spreading the `hasattr(..., "message_dict") disease outside `ValidationError`, I think the patch should introduce a new `has_dict` property on `ValidationError` that keeps that check internal to the implementation (and may as well clean up the internal `hasattr` uses to use the new property too).5 Rather than spreading the `hasattr(..., "message_dict")` disease outside `ValidationError`, I think the patch should introduce a new `has_dict` property on `ValidationError` that keeps that check internal to the implementation (and may as well clean up the internal `hasattr` uses to use the new property too). 6 6 7 7 Also, a note should be added to the docs that this is possible, and showing how its done. And we need a new test demonstrating that it works.