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