Added properties to allow sortable change list and change form view to extend a custom template or extend the default admin change form and change list templates.

Fixed a problem with the detection of sortability of inline models at the template level that was preventing the drag-and-drop messaging in the template to be displayed.
Updated unit tests.
This commit is contained in:
Brandon Taylor
2013-05-03 08:35:17 -04:00
parent 32c6f7c034
commit 847b471872
9 changed files with 39 additions and 30 deletions
@@ -1,4 +1,4 @@
{% extends "admin/change_form.html" %}
{% extends change_form_template_extends %}
{% load i18n admin_modify %}
{% load url from future %}
@@ -1,4 +1,4 @@
{% extends 'admin/change_list.html' %}
{% extends change_list_template_extends %}
{% load i18n %}
{% block object-tools-items %}
@@ -6,4 +6,4 @@
<a href="./sort/">{% trans 'Change Order' %}</a>
</li>
{{ block.super }}
{% endblock %}
{% endblock %}
@@ -1,6 +1,6 @@
{% load i18n admin_modify adminsortable_tags %}
<div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
<h2>{{ inline_admin_formset.opts.verbose_name_plural|title }} {% if inline_admin_formset.opts.is_sortable %} - drag and drop to change order{% endif %}</h2>
<h2>{{ inline_admin_formset.opts.verbose_name_plural|title }} {% if inline_admin_formset.formset.initial_form_count > 1 %} - drag and drop to change order{% endif %}</h2>
{{ inline_admin_formset.formset.management_form }}
{{ inline_admin_formset.formset.non_form_errors }}
@@ -3,7 +3,7 @@
<div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
{{ inline_admin_formset.formset.management_form }}
<fieldset class="module">
<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }} {% if inline_admin_formset.opts.is_sortable %} - drag and drop to change order{% endif %}</h2>
<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }} {% if inline_admin_formset.formset.initial_form_count > 1 %} - drag and drop to change order{% endif %}</h2>
{{ inline_admin_formset.formset.non_form_errors }}
<table>
<thead><tr>