{% extends "admin/polymorphic_tree/change_form.html" %}
{% load i18n admin_urls admin_modify %}

{% comment %}
    Override the content block, so all templates will have the same set of blocks.

    This adds:
    * after_first_fieldset
    * the check of "original.is_published" in the toolbar
{% endcomment %}
{% block content %}<div id="content-main">
{% block object-tools %}
{% if change and not is_popup %}
  <ul class="object-tools">
    {% block object-tools-items %}
    <li>
        {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
        <a href="{{ history_url }}" class="historylink">{% trans "History" %}</a>
    </li>
    {% if original.is_published and original.url %}<li><a href="{{ original.url }}" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif %}
    {% endblock %}
  </ul>
{% endif %}
{% if language_tabs %}{% include "admin/parler/language_tabs.html" %}{% endif %}{# manually included, this template overrides parler defaults #}
{% endblock %}
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %}
{% if errors %}
    <p class="errornote">
    {% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
    </p>
    {{ adminform.form.non_field_errors }}
{% endif %}

{% block field_sets %}
{# first fieldset #}
{% for fieldset in adminform %}
  {% if forloop.first %}{% include "admin/includes/fieldset.html" %}{% endif %}
{% endfor %}

{% block after_first_fieldset %}{% endblock %}

{# all remaining fieldsets #}
{% for fieldset in adminform %}
  {% if not forloop.first %}{% include "admin/includes/fieldset.html" %}{% endif %}
{% 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 %}{% submit_row %}{% endblock %}

{% if adminform and add %}
   <script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
{% endif %}

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

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