{% extends "blockadmin/base_site.html" %}
{% load i18n admin_urls admin_static admin_modify %}


{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{{ media }}
{% endblock %}

{% block coltype %}colM{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}

{% block content %}<div id="content-main">

<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1" />{% endif %}
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}" />{% endif %}
{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %}

{% if errors %}
    <p class="errornote">
        {% if errors|length == 1 %}
            {% trans "Please correct the error below." %}
        {% else %}
            {% trans "Please correct the errors below." %}
        {% endif %}
    </p>
    {{ adminform.form.non_field_errors }}
{% endif %}

{% block messages %}
    {% if messages %}
        {% for message in messages %}
            <p {% if message.tags %}class="{{ message.tags }}"{% endif %}>
                {{ message|capfirst }}
            </p>
        {% endfor %}
    {% endif %}
{% endblock messages %}


{% block field_sets %}
    {% for fieldset in adminform %}
        {% include "admin/glitter/includes/fieldset.html" %}
    {% endfor %}
{% endblock %}

{% block after_field_sets %}{% endblock %}

{% block inline_field_sets %}
{% for inline_admin_formset in inline_admin_formsets %}
    {% include inline_admin_formset.opts.template %}
{% endfor %}
{% endblock %}

{% block after_related_objects %}{% endblock %}

{% block submit_buttons_bottom %}
{% with has_delete_permission=False has_add_permission=False %}
    {% submit_row %}
{% endwith %}
{% endblock %}

{% if adminform and add %}
    <script type="text/javascript">
        (function($) {
            $(document).ready(function() {
                $('form#{{ opts.model_name }}_form :input:visible:enabled:first').focus()
            });
        })(django.jQuery);
    </script>
{% endif %}

{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}

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