Proper context and breadcrumbs

master
Igor Sobolev 2016-11-02 12:47:36 -04:00
parent b96896d890
commit 12fbb62302
2 changed files with 12 additions and 8 deletions

View File

@ -219,11 +219,11 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
except AttributeError:
verbose_name_plural = opts.verbose_name_plural
context = {
context = self.admin_site.each_context(request)
context.update({
'title': u'Drag and drop {0} to change display order'.format(
capfirst(verbose_name_plural)),
'opts': opts,
'app_label': opts.app_label,
'has_perm': True,
'objects': objects,
'group_expression': sortable_by_expression,
@ -232,7 +232,7 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
'sortable_by_class_display_name': sortable_by_class_display_name,
'jquery_lib_path': jquery_lib_path,
'csrf_cookie_name': getattr(settings, 'CSRF_COOKIE_NAME', 'csrftoken')
}
})
return render(request, self.sortable_change_list_template, context)
def add_view(self, request, form_url='', extra_context=None):

View File

@ -37,12 +37,16 @@
{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="../../../">
<a href="{% url 'admin:index' %}">
{% trans "Home" %}
</a>
&rsaquo;
<a href="../../">
{{ app_label|capfirst }}
&rsaquo;
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">
{{ opts.app_config.verbose_name }}
</a>
&rsaquo;
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ opts.verbose_name_plural|capfirst }}
</a>
&rsaquo;
{% trans 'Reorder' %}
@ -72,7 +76,7 @@
{% block object-tools %}
<ul class="object-tools">
<li>
<a href="../">
<a href="{% url opts|admin_urlname:'changelist' %}">
{% blocktrans with opts.verbose_name_plural|capfirst as model %}Return to {{ model }}{% endblocktrans %}
</a>
</li>