summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2013-06-11 16:05:19 +0100
committerWilfred Hughes <me@wilfred.me.uk>2013-06-11 16:05:19 +0100
commitb79aa796d8fe0d28778605b6b294e3e3a3f9ca65 (patch)
treecf798ed62f4c5af91cb52b4dd124bb4d9f642397 /docs
parent51739c624185b4b45877f521ed5015f2fe01b6e8 (diff)
FormSet.forms is an iterable, so just iterate over it
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/forms/formsets.txt3
1 files changed, 1 insertions, 2 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt
index e86a14913d..77341cf55d 100644
--- a/docs/topics/forms/formsets.txt
+++ b/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.")