summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2013-06-15 22:34:25 +0200
committerTim Graham <timograham@gmail.com>2013-06-16 15:49:30 -0400
commit1b7634a0d0e21faba71a27ae7951d7cb7aec0e49 (patch)
tree2f8bfcd40db77f76410364f66be89ee584947c42 /docs
parentaa22cbd51aa6cb35fc658dd704948a18b27d1981 (diff)
Fixed #20464 -- Added a `total_error_count` method on formsets.
Thanks to frog32 for the report and to Tim Graham for the review.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.6.txt3
-rw-r--r--docs/topics/forms/formsets.txt17
2 files changed, 20 insertions, 0 deletions
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt
index 458ccdc2a5..7d449edbe5 100644
--- a/docs/releases/1.6.txt
+++ b/docs/releases/1.6.txt
@@ -315,6 +315,9 @@ Minor features
:class:`~django.contrib.admin.InlineModelAdmin` may be overridden to
customize the extra and maximum number of inline forms.
+* Formsets now have a
+ :meth:`~django.forms.formsets.BaseFormSet.total_error_count` method.
+
Backwards incompatible changes in 1.6
=====================================
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt
index 77341cf55d..29139c5dea 100644
--- a/docs/topics/forms/formsets.txt
+++ b/docs/topics/forms/formsets.txt
@@ -164,6 +164,23 @@ As we can see, ``formset.errors`` is a list whose entries correspond to the
forms in the formset. Validation was performed for each of the two forms, and
the expected error message appears for the second item.
+.. currentmodule:: django.forms.formsets.BaseFormSet
+
+.. method:: total_error_count(self)
+
+.. versionadded:: 1.6
+
+To check how many errors there are in the formset, we can use the
+``total_error_count`` method::
+
+ >>> # Using the previous example
+ >>> formset.errors
+ [{}, {'pub_date': [u'This field is required.']}]
+ >>> len(formset.errors)
+ 2
+ >>> formset.total_error_count()
+ 1
+
We can also check if form data differs from the initial data (i.e. the form was
sent without any data)::