Permalink
Browse files

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

  • Loading branch information...
1 parent 51739c6 commit b79aa796d8fe0d28778605b6b294e3e3a3f9ca65 @Wilfred Wilfred committed Jun 11, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 docs/topics/forms/formsets.txt
View
3 docs/topics/forms/formsets.txt
@@ -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.")

0 comments on commit b79aa79

Please sign in to comment.