On Tue, Oct 11, 2016 at 04:28:40PM +0200, ludovic coues wrote: > First time you access form.errors, it will call form.full_clean. > > But after looking at the code and not simply reading the doc, I agree > that is_valid should be a property. After the first call to is_valid, > the value won't change, even if a field is set to a non-valid value.
Personally, I'd argue that the opposite should be true; is_valid should remain a method, and instead, we should change errors to no longer trigger full validation on first access. One possibility which would make sense to me would be that form.is_valid() could be the only supported way to trigger full validation, and form.errors could raise an error if it's accessed before calling is_valid first. The reasons I see for this change have been articulated pretty clearly by several people in this thread already... Of course, this would have to go through a full deprecation period, since the current behavior of form.errors is documented [0]... Cheers, Michal [0]: https://docs.djangoproject.com/en/1.10/ref/forms/api/#django.forms.Form.errors -- 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 django-developers@googlegroups.com. 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/20161011143736.GA12099%40koniiiik.org. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Digital signature