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

{% block extrahead %}{{ block.super }}
<script type="text/javascript">
  function verify_checked() {
    checkboxes = document.querySelectorAll("input.update_checkbox");
    some_checked = false;
    for (var i = 0, len = checkboxes.length; i < len; i++) {
      if ( checkboxes[i].checked ) {
        some_checked = true;
      }
    }
    if ( ! some_checked ) {
    	some_checked = confirm('You have not checked off any fields to update. Are you sure you wish to continue?');
    }
    return some_checked;
  }
</script>
{% endblock %}

{% block breadcrumbs %}{% if not is_popup %}
<div id="breadcrumbs" class="breadcrumbs">
     <a href="../../../">{% trans "Home" %}</a> &rsaquo;
     <a href="../../">{{ app_label|capfirst|escape }}</a> &rsaquo; 
     {% if has_change_permission %}<a href="../../{{ opts.object_name.lower }}/">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo; 
     {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ object_ids|truncchar:50 }}{% endif %}
</div>
{% endif %}{% endblock %}

{% block content %}<div id="content-main">
{% block object-tools %}

{% endblock %}
<form onsubmit="return verify_checked()" {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
<div>
<input type="hidden" name ="_changelist_filters" value="{{ request.META.HTTP_REFERER }}" />
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% if save_on_top %}{% include "admin/save_only_submit_line.html" %}{% 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>
    <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
{% endif %}

{% for fieldset in adminform %}
     {% include "admin/includes/mass_fieldset.html" %}
{% endfor %}

{% block after_field_sets %}{% endblock %}

<!-- Too unstable. Enable at your own risk
{% for inline_admin_formset in inline_admin_formsets %}
    <input type="checkbox" name="_mass_change_{{ inline_admin_formset.formset.prefix }}"> {% trans "Mass Change" %}:
    {% include inline_admin_formset.opts.template %}
{% endfor %}
-->

{% block after_related_objects %}{% endblock %}

{% include "admin/save_only_submit_line.html" %}

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