diff options
Diffstat (limited to 'django/newforms/formsets.py')
| -rw-r--r-- | django/newforms/formsets.py | 12 |
1 files changed, 8 insertions, 4 deletions
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. |
