mirror of
https://github.com/django/django.git
synced 2025-11-23 12:26:57 +00:00
Fixed #12692 - Properly handle the extra clause of admin inline formsets. Also fixes #12703, second error.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12369 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f70a0882a3
commit
9555f2be9d
12 changed files with 186 additions and 88 deletions
|
|
@ -12,6 +12,7 @@ __all__ = ('BaseFormSet', 'all_valid')
|
|||
# special field names
|
||||
TOTAL_FORM_COUNT = 'TOTAL_FORMS'
|
||||
INITIAL_FORM_COUNT = 'INITIAL_FORMS'
|
||||
MAX_NUM_FORM_COUNT = 'MAX_NUM_FORMS'
|
||||
ORDERING_FIELD_NAME = 'ORDER'
|
||||
DELETION_FIELD_NAME = 'DELETE'
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ class ManagementForm(Form):
|
|||
def __init__(self, *args, **kwargs):
|
||||
self.base_fields[TOTAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
|
||||
self.base_fields[INITIAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
|
||||
self.base_fields[MAX_NUM_FORM_COUNT] = IntegerField(widget=HiddenInput)
|
||||
super(ManagementForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class BaseFormSet(StrAndUnicode):
|
||||
|
|
@ -56,7 +58,8 @@ class BaseFormSet(StrAndUnicode):
|
|||
else:
|
||||
form = ManagementForm(auto_id=self.auto_id, prefix=self.prefix, initial={
|
||||
TOTAL_FORM_COUNT: self.total_form_count(),
|
||||
INITIAL_FORM_COUNT: self.initial_form_count()
|
||||
INITIAL_FORM_COUNT: self.initial_form_count(),
|
||||
MAX_NUM_FORM_COUNT: self.max_num
|
||||
})
|
||||
return form
|
||||
management_form = property(_management_form)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue