{% load logger jsmin variable get_attr %}

{% block form_common_error %}
    <div class="system error">
        {% if form_error_message %}
            <p>{{ form_error_message }}</p>
        {% endif %}
        {% if form.non_field_errors %}
            <ol>
                {% for err in form.non_field_errors %}
                    <li><span>{{ err }}</span></li>
                {% endfor %}
            </ol>
        {% endif %}
    </div>
{% endblock %}

<form id="{{ form_id }}" action="{{ form_action }}" {% if form.is_multipart %}enctype="multipart/form-data" {% endif %}
      method="{{ method }}" accept-charset="utf-8">

    {% for field in form %}
        {% if form_field.html_before %}{{ form_field.html_before }}{% endif %}
        <div class="row" id="container_{{ field.id_for_label }}">
            <div class="rowleft">{{ field.label_tag }}</div>
            <div class="rowright{% if field.errors %} error{% endif %}">
                {{ field }}
                {% if field.errors %}
                    {% for error_msg in field.errors %}
                        <label for="{{ field.id_for_label }}"><span class="error">{{ error_msg }}</span></label>
                    {% endfor %}
                {% else %}
                    {% if field.help_text %}
                        <label for="{{ field.id_for_label }}"><span>{{ field.help_text }}</span></label>
                    {% endif %}
                {% endif %}
            </div>
            <div class="clearfix"></div>
        </div>
        {% if form_field.html_after %}{{ form_field.html_after }}{% endif %}
    {% endfor %}

    {% block form_submit %}
        <div class="row">
            <button type="submit" name="submit_button">
                <span>{{ form_submit|default:"Submit" }}</span>
            </button>
        </div>
    {% endblock %}

    {% if csrf_token_html %}
        {{ csrf_token_html }}
    {% else %}
        {% csrf_token %}
    {% endif %}

</form>