title: Django form wizard - customized form layout for each step
body: <p>At the moment I'm experimenting with django form wizard. The basic set-up works now and I'm able to call different templates for each step showing variable text.</p>
  
  <p>Now I want to take it a step further and create a customized form layout for each step. The documentation of Django shows a generic way to show the form, always with vertical alignment.</p>
  
  <p>In my experiment I have two steps:</p>
  
  <ul>
  <li>step 1: email and password (just two fields needing vertical alignment)</li>
  <li>step 2: personal data: address, profession, ...</li>
  </ul>
  
  <p>So for the step 2 I want to use a complete different form layout then step 1: using fieldsets, horizontal alignment of field (eg address: street and number), ...</p>
  
  <p>Starting from the django documentation I suppose that the below can work (did not test it yet):</p>
  
  <pre><code>{% block content %}
  # block step: variable text for each step
  {% block step %}{% endblock %}
  &lt;p&gt;Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}&lt;/p&gt;
  &lt;form action="" method="post"&gt;{% csrf_token %}
  &lt;table&gt;
  {{ wizard.management_form }}
  {% if wizard.form.forms %}
      {{ wizard.form.management_form }}
      {% for form in wizard.form.forms %}
          # block form_if: shows a complete customized form layout for each step
          {% block form_if %}{% endblock %}
      {% endfor %}
  {% else %}
      # block form_else: shows a complete customized form layout for each step
      {% block form_else %}{% endblock %}
  {% endif %}
  &lt;/table&gt;
  {% if wizard.steps.prev %}
  &lt;button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}"&gt;{% trans    "first step" %}&lt;/button&gt;
  &lt;button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}"&gt;{% trans "prev step" %}&lt;/button&gt;
  {% endif %}
  &lt;input type="submit" value="{% trans "submit" %}"/&gt;
  &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>But the problem I have here is that I have two <code>blocks</code>: <code>form_if</code> and <code>form_else</code> calling the same form layout. So then I have double maintenance of my form layout.</p>
  
  <p>Are there better ways to accomplish what I want to achieve?</p>
  
  <p>Thanks!</p>
  
  <p>Kind Regards</p>