_form.html 1.52 KB
Newer Older
1
<form action="." {% 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 %}">
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 %}
Patrick Kimber's avatar
Patrick Kimber committed
13
      <div class="pure-control-group">
14
        {% if field.label %}
15 16 17
          <strong>
            <label for='{{ field.id_for_label }}'>{{ field.label }}{% if field.help_text %} - {{ field.help_text }}{% endif %}:</label>
          </strong>
18
        {% endif %}
19 20 21
        {% if aligned %}
          {{ field }}
        {% endif %}
Patrick Kimber's avatar
Patrick Kimber committed
22
        {% for error in field.errors %}
23
          <span class="errorlist"><mark>{{ error }}</mark></span>
24 25 26
          {% if not aligned %}
            <br>
          {% endif %}
Patrick Kimber's avatar
Patrick Kimber committed
27
        {% endfor %}
28 29 30
        {% if not aligned %}
          {{ field }}
        {% endif %}
Patrick Kimber's avatar
Patrick Kimber committed
31 32 33 34
      </div>
    {% endfor %}
    <div class="pure-controls">
      <p>
Patrick Kimber's avatar
Patrick Kimber committed
35
        <input type="submit" value="{% if submit %}{{ submit }}{% else %}Submit{% endif %}" class="pure-button pure-button-primary" />
Patrick Kimber's avatar
Patrick Kimber committed
36 37 38 39 40 41
      </p>
    </div>
  </fieldset>
  {% for hidden in form.hidden_fields %}
    {{ hidden }}
  {% endfor %}
42 43 44
  {% if next %}
    <input type="hidden" name="next" value="{{ next }}" />
  {% endif %}
Patrick Kimber's avatar
Patrick Kimber committed
45
</form>