summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_formsets.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
index 31adb921ba..787f177677 100644
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -986,6 +986,24 @@ class FormsFormsetTestCase(TestCase):
self.assertEqual(list(formset.non_form_errors()),
['This is a non-form error'])
+ def test_validate_max_ignores_forms_marked_for_deletion(self):
+ class CheckForm(Form):
+ field = IntegerField()
+
+ data = {
+ 'check-TOTAL_FORMS': '2',
+ 'check-INITIAL_FORMS': '0',
+ 'check-MAX_NUM_FORMS': '1',
+ 'check-0-field': '200',
+ 'check-0-DELETE': '',
+ 'check-1-field': '50',
+ 'check-1-DELETE': 'on',
+ }
+ CheckFormSet = formset_factory(CheckForm, max_num=1, validate_max=True,
+ can_delete=True)
+ formset = CheckFormSet(data, prefix='check')
+ self.assertTrue(formset.is_valid())
+
data = {
'choices-TOTAL_FORMS': '1', # the number of forms rendered