{% extends 'dj_waff/base.html' %}

{% block content %}
    <div style="margin-top: 2em;margin-bottom: 2em">
        {% if form %}


            <form class="form-horizontal" action="." method="post">
                <fieldset>
                    <legend>
                    </legend>
                    {% csrf_token %}
                    {% if form.non_field_errors %}
                        <div class="form-group">
                            <div class="col-sm-12">
                                <div class="alert alert-danger alert-dismissible" role="alert">
                                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                                    {% for error in form.non_field_errors %}
                                        {{ error }}{% if not forloop.last %}<br>{% endif %}
                                    {% endfor %}
                                </div>
                            </div>
                        </div>
                    {% endif %}
                    {% for form_field in form %}
                        <div class="form-group {% if form_field.errors %}has-error{% endif %}">
                            <label for="{{ form_field.id_for_label }}"
                                   class="control-label">{{ form_field.label }}</label>
                            <div class="">
                                {{ form_field }}

                                <span id="helpBlock2">


                                    {% if form_field.errors %}
                                        {% for error in form_field.errors %}
                                            <p id="error_{{ forloop.counter }}_{{ form_field.auto_id }}"
                                               class="help-block">
                                                <strong>{{ error }}</strong></p>
                                        {% endfor %}
                                    {% endif %}
                                    {% if form_field.help_text %}
                                        <p id="hint_{{ form_field.auto_id }}"
                                           class="help-block">{{ form_field.help_text|safe }}</p>
                                    {% endif %}
                                </span>
                            </div>
                        </div>
                    {% endfor %}
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-success">Save</button>
                        </div>
                    </div>
                </fieldset>

            </form>
            </div>
        {% endif %}
{% endblock content %}

{% block extrajs %}

    {{ form.media }}
{% endblock extrajs %}
