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

{% block content %}
    <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
        <div>
            <!-- Popup Hidden Field -->
            {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}

            <!-- !!! START:StreamField Popup Hidden Field !!! -->
            {% if request.GET.block_id and is_popup %}<input type="hidden" name="block_id" value="{{ request.GET.block_id }}" />{% endif %}
            {% if request.GET.instance_id and is_popup %}<input type="hidden" name="instance_id" value="{{ request.GET.instance_id }}" />{% endif %}
            {% if request.GET.app_id and is_popup %}<input type="hidden" name="app_id" value="{{ request.GET.app_id }}" />{% endif %}
            <!-- !!! END:  StreamField Popup Hidden Field !!! -->

            <!-- No Submit-Row on Top -->

            <!-- Errors -->
            {% if errors %}
                <p class="errornote">{% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}</p>
                <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
            {% endif %}

            <!-- Fieldsets -->
            {% block field_sets %}
                {% for fieldset in adminform %}
                    {% include "admin/includes/fieldset.html" %}
                {% endfor %}
            {% endblock %}

            {% block after_field_sets %}{% endblock %}

            <!-- Inlines -->
            {% 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 %}

            <!-- Submit-Row -->
            {% block submit_buttons_bottom %}{% submit_row %}{% endblock %}

            <!-- JS for prepopulated fields -->
            {% prepopulated_fields_js %}

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

