mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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
This commit is contained in:
@@ -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 ###########################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user