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

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

{% block extrastyle %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}"/>
{% endblock %}

{% block breadcrumbs %}
    <div class="breadcrumbs">
        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
        &rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ app_label|capfirst|escape }}</a>
        &rsaquo; {% if has_change_permission %}<a href="{% url opts|admin_urlname:'changelist' %}">
        {{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
        &rsaquo; {% trans 'Preview' %}
    </div>
{% endblock %}

{% block content %}
<div class="commandlinetool">
    <form action="{% url opts|admin_urlname:action %}" method="post" id="commandlinetool_prepare_form"
          {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
        {% csrf_token %}
        {% if tool %}
        <input type="hidden" value="{{ tool.tool }}" name="tool" />
        {% endif %}
        <div>
            {% for fieldset in adminform %}
              <fieldset disabled="disabled" class="disabled">
                {% include "admin/includes/fieldset.html" %}
              </fieldset>
              <div style="display:none">
                {% include "admin/includes/fieldset.html" %}
              </div>
            {% endfor %}
        </div>
        <h3>Below is a preview log of the changes that WOULD BE made by running this command. Please review carefully and then commit changes by clicking the "Run Command" button below. Or click the "Change Command" button to return to the previous screen.</h3>
        <div class="result">
        {{ tool.pretty_result|safe }}
        </div>
        <div class="submit-row">
            <input type="button" onclick="javascript:window.history.back();" value="Change Command" class="default" />
            <input type="submit" value="{{ action|upper }} Command" {% if tool.status == 1 %}disabled="disabled"{% endif %} class="default"/>
        </div>
    </form>
</div>
{% endblock %}
