Hi Carsten. Any chance you can put this into a failing test case in a PR? (Much easier to reason about code. 🙂)
Thanks. C. On Wednesday, 8 May 2019 13:58:25 UTC+2, Carsten Fuchs wrote: > > Dear group, > > I just upgraded from Django 1.11 to 2+ and thereby found > https://code.djangoproject.com/ticket/28321 > The ticket was resolved with commit > https://github.com/django/django/commit/f32d24652b920135eb6a0f3de74599f03e181731 > > > Well, this change leaves us with a situation where `formset.forms` > possibly no longer aligns with `self.errors`. > > Was that intended? > > The original ticket reporter suggested that for a deleted form with > errors, an empty dict should be added to formset._errors in a formset's > full_clean(). This would have preserved the alignment of formset.forms and > formset.errors. > > Note that the formset implementation often uses index-based iterations > over the forms which seems to suggest, although there is no other > indication or hint, that formset.forms[i] correlates to formset.errors[i] > for all valid i. (That was also my understanding from the documentation > before having looked at the implementation.) > > [ In my application code I have the requirement that even deleted forms > must meet certain validation criteria. Therefore I relied on the Django > 1.11 / pre-#28321 behavior, where at the same time formset.is_valid() == > True and any(formset.errors) == True was possible. While I found this > undocumented, it was my preferred behavior. ] > > Any thoughts? > > Best regards, > Carsten > > -- 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 https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a4703c73-6c25-46ef-a948-c3377057d09a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
