﻿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
14009	custom formset validation documentation is incomplete	splatEric <mike@…>	Tobias Kunze	"The example for performing custom formset validation is incomplete. It does not take into account deleted forms, or empty forms for checking the unique titles constraint. It should read something along the lines of (changes highlighted by *>):


{{{
>>> 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
...         titles = []
...         for i in range(0, self.total_form_count()):
*>             if self.can_delete and self._should_delete_form(form):
*>                continue
...             form = self.forms[i]
*>             if 'title' in form.cleaned_data:
...                 title = form.cleaned_data['title']
...                 if title in titles:
...                     raise forms.ValidationError, ""Articles in a set must have distinct titles.""
...                 titles.append(title)
}}}
"	Bug	closed	Documentation	dev	Normal	fixed	formset validation		Accepted	1	0	0	0	0	0
