I don't think that spreading add_error to more places really helps with the "more than one way to do it" issue - raising ValidationError isn't going anywhere as documented public API. It's still the simplest thing to do from a clean_field method, or if you want the error in non_field_errors.
I realize that add_error() is a useful internal API, just not clear that it makes sense to have two public APIs for adding errors. "Easier to add errors from a view" doesn't carry weight for me: poking errors into a form from outside the form is smelly (violates the encapsulation of the form class), so I think it's good if it also looks smelly, rather than being easy. But as I said before, the "add_error() as public API" ship has already sailed, and I don't believe that it's worth trying to reverse its course now. I am in favor of Alasdair's current PR simply documenting ValidationError(dict) for model validation. Carl -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/546DD518.4080907%40oddbird.net. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
