From 2ba9df2f41cd649b42f5d7452aa2393aa6131f32 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 28 Apr 2009 14:17:18 +0000 Subject: Fixed #10082 -- Modified BaseFormSet so that ordering checks work when the formset is empty. Thanks to Petr Marhoun for the report and test case, and bmathieu for the fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10643 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/formsets.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/forms/formsets.py b/tests/regressiontests/forms/formsets.py index c3c89d078d..dd2b188fd2 100644 --- a/tests/regressiontests/forms/formsets.py +++ b/tests/regressiontests/forms/formsets.py @@ -394,6 +394,18 @@ True {'votes': 500, 'ORDER': None, 'choice': u'The Decemberists'} {'votes': 50, 'ORDER': None, 'choice': u'Basia Bulat'} +Ordering should work with blank fieldsets. + +>>> data = { +... 'choices-TOTAL_FORMS': '3', # the number of forms rendered +... 'choices-INITIAL_FORMS': '0', # the number of forms with initial data +... } + +>>> formset = ChoiceFormSet(data, auto_id=False, prefix='choices') +>>> formset.is_valid() +True +>>> for form in formset.ordered_forms: +... print form.cleaned_data # FormSets with ordering + deletion ########################################### -- cgit v1.3