_form.html 1.9 KB
Newer Older
1
<form action="{% if action %}{{ action }}{% else %}.{% endif %}" {% if form_id %}id="{{ form_id }}"{% endif %} method="{% if method %}{{ method }}{% else %}post{% endif %}" {% if multipart %}enctype="multipart/form-data"{% endif %} class="pure-form {% if aligned %}pure-form-aligned{% else %}pure-form-stacked{% endif %}{% if form_class %} {{ form_class }}{% endif %}">
2 3 4
  {% if not no_token %}
    {% csrf_token %}
  {% endif %}
5 6 7
  {% if form.non_field_errors %}
    {{ form.non_field_errors }}
  {% endif %}
Patrick Kimber's avatar
Patrick Kimber committed
8
  <fieldset>
9 10 11
    {% if legend %}
      <legend>{{ legend }}</legend>
    {% endif %}
12
    {% for field in form.visible_fields %}
13 14 15 16 17 18 19 20 21 22 23 24
      {% include '_form_field.html' with field=field %}
    {% endfor %}
    {% if formset %}
      {{ formset.management_form }}
    {% endif %}
    {% for formset_form in formset %}
      <legend>
        {{ formset_legend }}
        {% if formset_add %}
          {{ forloop.counter|add:formset_add }}:
        {% else %}
          {{ forloop.counter }}:
25
        {% endif %}
26 27 28
      </legend>
        {% for field in formset_form.visible_fields %}
        {% include '_form_field.html' with field=field %}
Patrick Kimber's avatar
Patrick Kimber committed
29
        {% endfor %}
30 31 32
      {% for hidden in formset_form.hidden_fields %}
      {{ hidden }}
      {% endfor %}
Patrick Kimber's avatar
Patrick Kimber committed
33 34 35
    {% endfor %}
    <div class="pure-controls">
      <p>
36
        <input type="submit" {% if submit_id %}id="{{ submit_id }}"{% else %}id="submit"{% endif %} value="{% if submit %}{{ submit }}{% else %}Submit{% endif %}" class="pure-button pure-button-primary" />
37 38 39
        {% if submit_2_id and submit_2_name and submit_2_value %}
          <input type="submit" id="{{ submit_2_id }}" name="{{ submit_2_name }}" value="{{ submit_2_value }}" class="pure-button" />
        {% endif %}
Patrick Kimber's avatar
Patrick Kimber committed
40 41 42 43 44 45
      </p>
    </div>
  </fieldset>
  {% for hidden in form.hidden_fields %}
    {{ hidden }}
  {% endfor %}
46 47 48
  {% if next %}
    <input type="hidden" name="next" value="{{ next }}" />
  {% endif %}
Patrick Kimber's avatar
Patrick Kimber committed
49
</form>