Hello Sven, > On 12 Oct 2016, at 12:21, Sven R. Kunze <srku...@gmail.com> wrote: > > Am Dienstag, 11. Oktober 2016 17:51:20 UTC+2 schrieb Aymeric Augustin: > > The API for displaying errors is form.errors. > > If the documentation implies otherwise, please accept my apologies! > > No problem. I now did read the documentation > (https://docs.djangoproject.com/es/1.10/ref/forms/api/) to be 100% sure. > > It says: "The primary task of a Form object is to validate data. With a bound > Form instance, call the is_valid() method to run validation and return a > boolean designating whether the data was valid:" and furthermore "You can > access errors without having to call is_valid() first. The form’s data will > be validated the first time either you call is_valid() or access errors." > > So, the docs are actually pretty clear about what will happen (how to code > works), but not so much about the intended usage.
The intended usage is shown here: https://docs.djangoproject.com/en/1.10/topics/forms/#the-view. The document goes on to describe various ways to render errors in template. Sorry, I overreacted because I failed to imagine other use cases. I withdraw my objections to using is_valid() in templates. While it’s (likely) not intended, it isn’t unrealistic either. I’m still -0 on changing is_valid to be a property because I still think it’s less appropriate (validation can be expensive) and the benefits are more limited than they were for is_authenticated / is_anonymous. -- Aymeric. -- 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 django-developers+unsubscr...@googlegroups.com. To post to this group, send email to firstname.lastname@example.org. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/C04506DD-2176-4C29-A90A-206A644216BE%40polytechnique.org. For more options, visit https://groups.google.com/d/optout.