{% extends "base.html" %}
{% block content %}
  <a href="{% url 'dancecalendar:add_event' %}" class="ui inverted right floated button">Add location</a>
  <form class= "ui form" method="post" action="{% block formtag %}{% endblock formtag %}">
    {% csrf_token %}
    {{ form.non_field_errors }}
    {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
    <div class="two fields">
      <div class="required field{% if form.name.errors %} error{% endif %}">
        <label for="{{ form.name.id_for_label }}">{{ form.name.label|safe }}</label>
        {{ form.name }}
        {% if form.name.errors %}
          <div class="ui inverted red message">
            {{ form.name.errors }}
          </div>
        {% endif %}
      </div>
      <div class="required field{% if form.location.errors %} error{% endif %}">
        <label for="{{ form.location.id_for_label }}">{{ form.location.label|safe }}</label>
        {{ form.location }}
        {% if form.location.errors %}
          <div class="ui inverted red message">
            {{ form.location.errors }}
          </div>
        {% endif %}
      </div>
    </div>
    <div class="field{% if form.description.errors %} error{% endif %}">
      <label for="{{ form.description.id_for_label }}">{{ form.description.label|safe }}</label>
      {{ form.description }}
      {% if form.description.errors %}
        <div class="ui inverted red message">
          {{ form.description.errors }}
        </div>
      {% endif %}
    </div>
    <div class="field{% if form.doors_open.errors %} error{% endif %}">
      <label for="{{ form.doors_open.id_for_label }}">{{ form.doors_open.label|safe }}</label>
      {{ form.doors_open }}
      {% if form.doors_open.errors %}
        <div class="ui inverted red message">
          {{ form.doors_open.errors }}
        </div>
      {% endif %}
    </div>
    
  </form>
{% endblock %}
