{% extends "admin/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 extrastyle %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
{% 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">
    {% block object-tools %}
        {% if change %}
            {% if not is_popup %}
            <ul class="object-tools">
                {% block object-tools-items %}
                <li>
                    {% url opts|admin_urlname:'history' omni_form.pk|admin_urlquote as history_url %}
                    <a href="{% add_preserved_filters history_url %}" class="historylink">{% trans "History" %}</a>
                </li>
                {% if has_absolute_url %}
                <li>
                    <a href="{{ absolute_url }}" class="viewsitelink">{% trans "View on site" %}</a>
                </li>
                {% endif %}
                {% endblock %}
            </ul>
            {% endif %}
        {% endif %}
    {% endblock %}

    <form action="." method="post" id="{{ opts.model_name }}_form" novalidate>
        {% csrf_token %}
        {% block form_top %}{% endblock %}
        <div>
            {% if form.errors %}
                <p class="errornote">
                    {% if errors|length == 1 %}
                        {% trans "Please correct the error below." %}
                    {% else %}
                        {% trans "Please correct the errors below." %}
                    {% endif %}
                </p>
                {{ form.non_field_errors }}
            {% endif %}

            {% for field in form.hidden_fields %}
                    {% if field.errors %}{{ field.label }}{{ field.errors }}{% endif %}
                {{ field }}
            {% endfor %}

            <fieldset class="module aligned">
                {% for field in form.visible_fields %}
                <div class="form-row {% if field.errors %}errors {% endif %}field-{{ field.name }}">
                    {% if field.errors %}{{ field.errors }}{% endif %}
                    <div>
                        <label{% if field.field.required %} class="required"{% endif %} for="{{ field.auto_id }}">{{ field.label }}</label>
                        {{ field }}
                        {% if field.help_text %}<p class="help">{{ field.help_text|safe }}</p>{% endif %}
                    </div>
                </div>
                {% endfor %}
            </fieldset>

            {% block submit_buttons_bottom %}
            <div class="submit-row">
                <input type="submit" value="Save" class="default" name="_save">
                <input type="submit" value="Save and add another" name="_addanother">
            </div>
            {% endblock %}
            {% prepopulated_fields_js %}
        </div>
    </form>
</div>
{% endblock %}
