{{ errors }}
{% if errors and not fields %}
  <p>{% for field in hidden_fields %}{{ field }}{% endfor %}</p>
{% endif %}
{% for field, errors in fields %}
  {{ errors }}
  <p{% set classes = field.css_classes() %}{% if classes %} class="{{ classes }}"{% endif %}>
    {% if field.label %}{{ field.label_tag() }}{% endif %}
    {{ field }}
    {% if field.help_text %}
      <span class="helptext">{{ field.help_text|safe }}</span>
    {% endif %}
    {% if loop.last %}
      {% for field in hidden_fields %}{{ field }}{% endfor %}
    {% endif %}
  </p>
{% endfor %}
{% if not fields and not errors %}
  {% for field in hidden_fields %}{{ field }}{% endfor %}
{% endif %}
