From 3b92ced51856e740cd6fb3d3e5bb8ea932bd276e Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Tue, 10 Jun 2008 03:54:05 +0000 Subject: newforms-admin: Fixed #5520 -- Implemented save_as functionality. This also properly makes inlines work as well. git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7603 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/formsets.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'django/newforms/formsets.py') diff --git a/django/newforms/formsets.py b/django/newforms/formsets.py index b9e4a1fd02..8a76a54042 100644 --- a/django/newforms/formsets.py +++ b/django/newforms/formsets.py @@ -57,14 +57,18 @@ class BaseFormSet(StrAndUnicode): 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 = [] - for i in range(self._total_form_count): - self.forms.append(self._construct_form(i)) + # construct the forms in the formset + self._construct_forms() def __unicode__(self): return self.as_table() + def _construct_forms(self): + # instantiate all the forms and put them in self.forms + self.forms = [] + for i in xrange(self._total_form_count): + self.forms.append(self._construct_form(i)) + def _construct_form(self, i): """ Instantiates and returns the i-th form instance in a formset. -- cgit v1.3