title: multiple forms in one step, Django Wizard form
body: <p>I am trying to create 2 Model Forms in on Step, one of them is Modelformset, does someone did this before, it will be very helpful.
  I am using Django 2 in my project.
  Thank you.</p>
  <pre><code>class Post(models.Model):
      main_image = models.ImageField('main_image', upload_to='main_images/', blank=True, null=True)
  
      def __str__(self):
          return str(self.pk)
  
  
  class PostImages(models.Model):
      image = models.ImageField('Foto', upload_to='post_images/', blank=True, null=True)
      post = models.ForeignKey(Post,related_name='myposts',on_delete=models.CASCADE, null=True)
      def __str__(self):
          return str(self.pk)
  </code></pre>
  <p>my Forms.py</p>
  <p>Here I am Trying to create two forms, first one is main_image and the other is formsetfield in one step. that works but i can not get the instance of my formset so i can not save it.</p>
  <pre><code>class step3Form(forms.ModelForm):
      main_image = forms.FileField(widget=forms.FileInput(attrs={'class': 'custom-control'}), required=True, label=_('Hauptbild:'))
      formsetfield = modelformset_factory(PostImages, ImageForm, can_delete=True)
      class Meta:
          model = Post
          fields = ('main_image',)
      def __init__(self, *args, **kwargs):
          super(step3Form, self).__init__(*args, **kwargs)
  
  </code></pre>
  <p>views.py</p>
  <p>what schuld I do here to get the instance of my Formset? in order to save it!</p>
  <pre><code>class PostCreateView(LoginRequiredMixin, SessionWizardView):
      instance = None
      form_list = [PostForm, PostFormSecondStep, step3Form, step4Form]
      file_storage = FileSystemStorage(location=os.path.join(settings.MEDIA_ROOT, 'media'))
  
      def get_template_names(self):
          return [TEMPLATES[self.steps.current]]
  
      def get_form_instance(self, step):
          if self.instance is None:
              self.instance = Post()
          return self.instance
  
      def done(self, form_list, form_dict, **kwargs):
          form_data_dict = self.get_all_cleaned_data()
          result = {}
          self.instance.author = self.request.user.profile
          form_list[2].save()
          self.instance.save()
          form_data =  [form.cleaned_data for form in form_list]
          return redirect('post_app:post_create_page')
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          return context
  </code></pre>
  <p>html</p>
  <pre><code>          &lt;form method=&quot;post&quot; id=&quot;msform&quot; enctype=&quot;multipart/form-data&quot;&gt;
              {% csrf_token %}
              {{ wizard.management_form }}
              {% if wizard.form.forms %}
              {% for form in wizard.form.forms %}
                            {{ form }}
                            {% endfor %}
                  {% else %}
                  {% if wizard.form.non_field_errors %}
                      &lt;ul&gt;
                        {% for error in wizard.form.non_field_errors %}
                        &lt;li&gt;{{ error }}&lt;/li&gt;
                        {% endfor %}
                      &lt;/ul&gt;
                      {% endif %}
                      {{ wizard.form.main_image.label_tag }}
                      {{ wizard.form.main_image }}
                      {{ wizard.form.main_image.errors }}
                      {{ wizard.form.formsetfield.errors }}
                  &lt;div id=&quot;formset&quot; data-formset-prefix=&quot;{{ wizard.form.formsetfield.prefix }}&quot;&gt;
                    {{ wizard.form.formsetfield.management_form }}
                    &lt;div data-formset-body&gt;
                      {% for form in wizard.form.formsetfield %}
                      {{ form.non_field_errors }}
                        {{ form.errors }}
                      &lt;div data-formset-form&gt;
                        {{ form }}
                        &lt;span class=&quot;p-2&quot;&gt;&lt;a class=&quot;cursor-pointer&quot; data-formset-delete-button&gt;&lt;i class=&quot;far fa-trash-alt&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      {% endfor %}
                    &lt;/div&gt;
                    
                    &lt;input type=&quot;button&quot; class=&quot;btn btn-outline-dark&quot; value=&quot;Hinzufügen&quot; data-formset-add&gt;
                  &lt;/div&gt;
              {% endif %}
              &lt;button type=&quot;submit&quot; id=&quot;submit_btn&quot; class=&quot;action-button&quot; name=&quot;button&quot;&gt;Weiter&lt;/button&gt;
              {% if wizard.steps.prev %}
              &lt;button name=&quot;wizard_goto_step&quot; class=&quot;action-button&quot; type=&quot;submit&quot; value=&quot;{{ wizard.steps.first }}&quot;&gt;Erster Schritt&lt;/button&gt;
              &lt;button name=&quot;wizard_goto_step&quot; id=&quot;back_btn&quot; class=&quot;action-button&quot; type=&quot;submit&quot; value=&quot;{{ wizard.steps.prev }}&quot;&gt;Zurück&lt;/button&gt;
              {% endif %}
            &lt;/form&gt;
  </code></pre>