{% extends 'base.html' %}

{% block content %}
<div class="container">
    <div class="row center">
        <div class="col-md-6 offset-md-3">
            <h2>Create new poll</h2>
            {% if messages %}
            <ul class="messages">
                {% for message in messages %}
                <li {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</li>
                {% endfor %}
            </ul>
            {% endif %}
            <form action="" method="POST">
                {% csrf_token %}
                {% for field in form %}
                <div class="form-group">
                    {{ field.errors }}
                    {{ field.label_tag }}
                    {{ field }}
                </div>
                {% endfor %}
                <button type="submit" class="btn btn-primary">Add Poll</button>
                <a class="btn btn-warning" href="{% url 'polls:list' %}" role="button">Back</a>
            </form>
        </div>
    </div>
</div>
{% endblock %}