{% extends 'base.html' %}

{% block main %}
<form action="" method="POST">
  <button type="submit" style="margin-top: 20px; margin-bottom: 20px" class="btn">Proceed</button>
  {% if form.action in safe_urls %}
    {% csrf_token %}
  {% endif %}
  {% if form.errors %}
  <div class="w3-red w3-padding">
      <strong>Errors found</strong> - please check the error messages below and try again
  </div>
  {% endif %}

  {% for field in form %}
      {% if field.type == "HiddenField" %}
          {{ field }}
      {% else %}
          <div class="w3-cell-row w3-padding w3-margin {% if field.errors %}w3-red{% else %}w3-gray{% endif %}">
            <div class="w3-cell w3-half">
              {{ field.label }}
              {{ field }}
            </div>
            <div class="w3-cell w3-half">
              {% for error in field.errors %}
                  <ul class="error-block">
                      <li>{{ error }}</li>
                  </ul>
              {% endfor %}
            </div>
          </div>
      {% endif %}
  {% endfor %}
  <button type="submit" style="margin-top: 20px; margin-bottom: 20px" class="btn">Proceed</button>
</form>
{% endblock %}
