1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

Fixed #20403 -- Ignore forms marked for deletion when validating max_num.

This commit is contained in:
Ryan Kaskel
2013-05-20 12:13:03 -04:00
committed by Carl Meyer
parent 266c0bb23e
commit 4280217f31
3 changed files with 22 additions and 2 deletions

View File

@@ -303,7 +303,8 @@ class BaseFormSet(object):
form = self.forms[i]
self._errors.append(form.errors)
try:
if (self.validate_max and self.total_form_count() > self.max_num) or \
if (self.validate_max and
self.total_form_count() - len(self.deleted_forms) > self.max_num) or \
self.management_form.cleaned_data[TOTAL_FORM_COUNT] > self.absolute_max:
raise ValidationError(ungettext(
"Please submit %d or fewer forms.",