0
0
mirror of https://github.com/django/django.git synced 2024-11-29 14:46:18 +01:00

FormSet.forms is an iterable, so just iterate over it

This commit is contained in:
Wilfred Hughes 2013-06-11 16:05:19 +01:00
parent 51739c6241
commit b79aa796d8

View File

@ -247,8 +247,7 @@ is where you define your own validation that works at the formset level::
... # 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()):
... form = self.forms[i]
... for form in self.forms:
... title = form.cleaned_data['title']
... if title in titles:
... raise forms.ValidationError("Articles in a set must have distinct titles.")