form.html 887 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
{% for error in form.non_field_errors %}
<div class="alert alert-danger alert-dismissable">
  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&#215;</button>
  {{error}}
</div>
{% endfor %}
{% for field in form %}{% if field.display %}
<div class="form-group{% spaceless %}
  {% if not form.non_field_errors %}
    {% if field.errors %} has-error
    {% elif form.cleaned_data %} has-success
    {% endif %}
  {% endif %}"
{% endspaceless %}>{% spaceless %}
  {% if field.checkbox %}
    <div class="checkbox"><label for="{{field.auto_id}}">{{field}}{{field.label}}</label>
  {% else %}
    <label class="control-label" for="{{field.auto_id}}">{{field.label}}</label>
    {{field}}
  {% endif %}
  {% for error in field.errors %}
    <span class="help-block">{{error}}</span>
  {% endfor %}
{% endspaceless %}</div>
{% else %}{{field}}{% endif %}{% endfor %}