{% extends "base.html" %}

{% block titleblock %}
{{ view.page_title }}
{% endblock %}

{% block content %}

{% load addclass %}

  <div class="row">
    <div class="col">
      <div class="card">
        <div class="card-body">
          <h1 class="card-title">{{ view.page_title }}</h1>
          <hr />
          
            {% if form.errors %}
              {% for field in form %}
                {% for error in field.errors %}
                  <div class="alert alert-danger" role="alert">{{ error }}</div>
                {% endfor %}
              {% endfor %}
            {% endif %}
          
          <form method="post" action="?">
            {% csrf_token %}
  
            {% for field in form %}
            <div class="form-field my-3">
                {{ field.label_tag }}
                {{ field | addclass:"form-control" }}
                {% if field.help_text %}
                <small class="form-text text-muted">{{ field.help_text|safe }}</small>
                {% endif %}
            </div>
            {% endfor %}
            
            <hr />
            <div class="form-group">
              <input class="form-control btn btn-outline-secondary" type="submit" value="Submit" />
              <input type="hidden" name="next" value="{{ next }}" />
            </div>
          </form>
          
        </div>
      </div>
    </div>
  </div>

{% endblock %}
