summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorStephen Burrows <stephen.r.burrows@gmail.com>2014-05-15 20:12:32 -0700
committerTim Graham <timograham@gmail.com>2014-05-16 06:38:24 -0400
commitd64f192df188903ea5a1ab8dfd6679e5d52aaf9b (patch)
tree4e30d099ba136c56c638483123c7477ea64995d4 /tests/forms_tests
parent4a981307359d5886d7e982aad8cfdac84d21152c (diff)
Fixed #22628 -- Took initial forms into account when combining FormSet.min_num and FormSet.extra.
Forwardport of 79f15ab1ef from stable/1.7.x
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_formsets.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
index 52dfdf4044..6b82f57343 100644
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -216,7 +216,7 @@ class FormsFormsetTestCase(TestCase):
def test_min_num_displaying_more_than_one_blank_form(self):
# We can also display more than 1 empty form passing min_num argument
- # to formset_factory. It will increment the extra argument
+ # to formset_factory. It will (essentially) increment the extra argument
ChoiceFormSet = formset_factory(Choice, extra=1, min_num=1)
formset = ChoiceFormSet(auto_id=False, prefix='choices')
@@ -225,6 +225,10 @@ class FormsFormsetTestCase(TestCase):
for form in formset.forms:
form_output.append(form.as_ul())
+ # Min_num forms are required; extra forms can be empty.
+ self.assertFalse(formset.forms[0].empty_permitted)
+ self.assertTrue(formset.forms[1].empty_permitted)
+
self.assertHTMLEqual('\n'.join(form_output), """<li>Choice: <input type="text" name="choices-0-choice" /></li>
<li>Votes: <input type="number" name="choices-0-votes" /></li>
<li>Choice: <input type="text" name="choices-1-choice" /></li>