Skip to content

Commit

Permalink
Set instance (not queryset) for InlineFormSet in wizard.
Browse files Browse the repository at this point in the history
  • Loading branch information
flibbertigibbet committed Oct 12, 2013
1 parent dd839a2 commit 885798a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions django/contrib/formtools/wizard/views.py
Expand Up @@ -406,9 +406,11 @@ def get_form(self, step=None, data=None, files=None):
'prefix': self.get_form_prefix(step, self.form_list[step]),
'initial': self.get_form_initial(step),
})
if issubclass(self.form_list[step], forms.ModelForm):
# If the form is based on ModelForm, add instance if available
# and not previously set.
form_class = self.form_list[step]
if issubclass(form_class, forms.ModelForm) or \
issubclass(form_class, forms.models.BaseInlineFormSet):
# If the form is based on ModelForm or InlineFormSet,
# add instance if available and not previously set.
kwargs.setdefault('instance', self.get_form_instance(step))
elif issubclass(self.form_list[step], forms.models.BaseModelFormSet):
# If the form is based on ModelFormSet, add queryset if available
Expand Down

0 comments on commit 885798a

Please sign in to comment.