﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30940	Documentation on formsets lists incomplete code to detect errors in clean()	Tiemo	nobody	"The documentation on FormSets at https://docs.djangoproject.com/en/2.2/topics/forms/formsets/ lists incomplete sample code to determine whether the formset has erorrs in clean().

The listing:

{{{
>>> class BaseArticleFormSet(BaseFormSet):
...     def clean(self):
...         """"""Checks that no two articles have the same title.""""""
...         if any(self.errors):
...             # Don't bother validating the formset unless each form is valid on its own
...             return
}}}

This check is not complete, the full_clean method calls form.errors on all forms in the formset at r349, even on forms that are to be removed. This results in self.errors containing errors for forms that are to be deleted.

However, FormSet.is_valid ignores errors in forms that are to be removed.

The result is that the any(self.errors) snippet returns True, even if only removed forms contain errors.
"	Bug	closed	Documentation	2.2	Normal	invalid	documentation		Unreviewed	0	0	0	0	0	0
