{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia %}
{% load panorama_admin %}

{% block extrahead %}{{ block.super }}
<script src="{{STATIC_URL}}panorama/js/OpenLayers.js"></script>'
{% endblock %}

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

{% block content %}<div id="content-main">
{% block object-tools %}
{% if change %}{% if not is_popup %}
  <ul class="object-tools">
    {% block object-tools-items %}{{ block.super }}{% endblock %}
  </ul>
{% endif %}{% endif %}
{% 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 %}{% submit_row %}{% 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 %}

{% for fieldset in adminform %}
  {% include "admin/includes/fieldset.html" %}
              {% ifequal fieldset.name None %}
                 <div id="panoramaselector">
                 {% if add %}
                     {% panorama_selector %}
                 {% else %}
                     {% panorama_selector original%}
                 {% endif %}
                 </div>
              {% endifequal %}
{% endfor %}

{% block after_field_sets %}{% endblock %}

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

{% block after_related_objects %}{% endblock %}

{% submit_row %}

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

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

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