Browse files

Set instance (not queryset) for InlineFormSet in wizard.

  • Loading branch information...
1 parent dd839a2 commit 885798aa250544bd5c6d3a7325dc5c20c0795f2c @flibbertigibbet committed Oct 11, 2013
Showing with 5 additions and 3 deletions.
  1. +5 −3 django/contrib/formtools/wizard/views.py
View
8 django/contrib/formtools/wizard/views.py
@@ -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

0 comments on commit 885798a

Please sign in to comment.