1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #22628 -- Took initial forms into account when combining FormSet.min_num and FormSet.extra.

Forwardport of 79f15ab1ef from stable/1.7.x
This commit is contained in:
Stephen Burrows
2014-05-15 20:12:32 -07:00
committed by Tim Graham
parent 4a98130735
commit d64f192df1
5 changed files with 13 additions and 12 deletions

View File

@@ -395,13 +395,12 @@ class ModelFormsetTest(TestCase):
def test_min_num_with_existing(self):
# Test the behavior of min_num with existing objects.
# See #22628 - this will change when that's fixed.
Author.objects.create(name='Charles Baudelaire')
qs = Author.objects.all()
AuthorFormSet = modelformset_factory(Author, fields="__all__", extra=0, min_num=1)
formset = AuthorFormSet(queryset=qs)
self.assertEqual(len(formset.forms), 2)
self.assertEqual(len(formset.forms), 1)
def test_custom_save_method(self):
class PoetForm(forms.ModelForm):