summaryrefslogtreecommitdiff
path: root/django/forms/formsets.py
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 /django/forms/formsets.py
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 'django/forms/formsets.py')
-rw-r--r--django/forms/formsets.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index fd98c43405..79e1c2298a 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -263,6 +263,13 @@ class BaseFormSet(object):
self.full_clean()
return self._errors
+ def total_error_count(self):
+ """
+ Returns the number of errors across all forms in the formset.
+ """
+ return len(self.non_form_errors()) +\
+ sum(len(form_errors) for form_errors in self.errors)
+
def _should_delete_form(self, form):
"""
Returns whether or not the form was marked for deletion.