summaryrefslogtreecommitdiff
path: root/django/newforms
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2008-03-30 23:54:55 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2008-03-30 23:54:55 +0000
commit613c391461cec08786c6ecfdfb287c740d47b1e4 (patch)
tree2b155463d88d7c2b63406c4c950889cc5f992920 /django/newforms
parentb2b6fb6b0704b8c788479c92f34bdababcb25054 (diff)
newforms-admin: Fixed #6926. Formset management forms now use the proper prefix. Thanks, msundstr.
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7391 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms')
-rw-r--r--django/newforms/formsets.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/django/newforms/formsets.py b/django/newforms/formsets.py
index a11aed8221..6cd7b54993 100644
--- a/django/newforms/formsets.py
+++ b/django/newforms/formsets.py
@@ -40,20 +40,21 @@ class BaseFormSet(StrAndUnicode):
self._non_form_errors = None
# initialization is different depending on whether we recieved data, initial, or nothing
if data or files:
- self.management_form = ManagementForm(data, files, auto_id=self.auto_id, prefix=self.prefix)
+ self.management_form = ManagementForm(data, auto_id=self.auto_id, prefix=self.prefix)
if self.management_form.is_valid():
self._total_form_count = self.management_form.cleaned_data[TOTAL_FORM_COUNT]
self._initial_form_count = self.management_form.cleaned_data[INITIAL_FORM_COUNT]
else:
raise ValidationError('ManagementForm data is missing or has been tampered with')
- elif initial:
- self._initial_form_count = len(initial)
- self._total_form_count = self._initial_form_count + self.extra
else:
- self._initial_form_count = 0
- self._total_form_count = self.extra
- initial = {TOTAL_FORM_COUNT: self._total_form_count, INITIAL_FORM_COUNT: self._initial_form_count}
- self.management_form = ManagementForm(initial=initial, auto_id=auto_id, prefix=prefix)
+ if initial:
+ self._initial_form_count = len(initial)
+ self._total_form_count = self._initial_form_count + self.extra
+ else:
+ self._initial_form_count = 0
+ self._total_form_count = self.extra
+ initial = {TOTAL_FORM_COUNT: self._total_form_count, INITIAL_FORM_COUNT: self._initial_form_count}
+ self.management_form = ManagementForm(initial=initial, auto_id=self.auto_id, prefix=self.prefix)
# instantiate all the forms and put them in self.forms
self.forms = []