Skip to content

Commit 52a0ad6

Browse files
committed
Fix breadcrumb for django-parler delete translation page.
Using standard admin_urlname filters instead of ../../
1 parent 1e01659 commit 52a0ad6

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Changes in git
22
--------------
33

44
* Fixed URL resolving for for multi admin sites.
5+
* Fixed URL breadcrumbs for delete page, visible when using non-standard delete URLs (e.g. django-parler_'s delete translation page).
56
* Enforcing at least django-polymorphic_ 0.7.1 for Django 1.8 compatibility.
67

78

@@ -145,6 +146,7 @@ and not bother with a plugin registration system.
145146

146147

147148
.. _django-fluent-pages: https://github.com/edoburu/django-fluent-pages
149+
.. _django-parler: https://github.com/edoburu/django-parler
148150
.. _django-polymorphic: https://github.com/chrisglass/django_polymorphic
149151
.. _django-tag-parser: https://github.com/edoburu/django-tag-parser
150152

polymorphic_tree/templates/admin/polymorphic_tree/change_form.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{% extends "admin/change_form.html" %}
2-
{% load i18n admin_modify polymorphic_admin_tags polymorphic_tree_admin_tags %}
2+
{% load i18n admin_modify admin_urls polymorphic_admin_tags polymorphic_tree_admin_tags %}
33

44
{# Add tree levels to polymorphic breadcrumb #}
55
{% block breadcrumbs %}{% if not is_popup %}{% breadcrumb_scope base_opts %}
66
<div class="breadcrumbs">
7-
<a href="../../../">{% trans "Home" %}</a> &rsaquo;
8-
<a href="../../">{{ app_label|capfirst|escape }}</a> &rsaquo;
9-
{% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo;
7+
<a href="{% url 'admin:index' %}">{% trans "Home" %}</a> &rsaquo;
8+
<a href="{% url 'admin:app_list' app_label=app_label %}">{{ app_label|capfirst|escape }}</a> &rsaquo;
9+
{% 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;
1010
{% for p in original|mptt_breadcrumb %}
11-
<a href="../{{ p.id }}/">{{ p }}</a> &rsaquo;
11+
<a href="{% url opts|admin_urlname:'change' p.id %}">{{ p.title }}</a> &rsaquo;
1212
{% endfor %}
1313
{% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
1414
</div>
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{% extends "admin/delete_confirmation.html" %}
2-
{% load i18n polymorphic_admin_tags polymorphic_tree_admin_tags %}
2+
{% load i18n admin_urls polymorphic_admin_tags polymorphic_tree_admin_tags %}
33

44
{# Add tree levels to polymorphic breadcrumb #}
55
{% block breadcrumbs %}{% breadcrumb_scope base_opts %}
66
<div class="breadcrumbs">
7-
<a href="../../../../">{% trans "Home" %}</a> &rsaquo;
8-
<a href="../../../">{{ app_label|capfirst|escape }}</a> &rsaquo;
9-
<a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
7+
<a href="{% url 'admin:index' %}">{% trans "Home" %}</a> &rsaquo;
8+
<a href="{% url 'admin:app_list' app_label=app_label %}">{{ app_label|capfirst|escape }}</a> &rsaquo;
9+
<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
1010
{% for p in object|mptt_breadcrumb %}
11-
<a href="../{{ p.id }}/">{{ p.title }}</a> &rsaquo;
11+
<a href="{% url opts|admin_urlname:'change' p.id %}">{{ p.title }}</a> &rsaquo;
1212
{% endfor %}
13-
<a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo;
13+
<a href="{% url opts|admin_urlname:'change' object.id %}">{{ object|truncatewords:"18" }}</a> &rsaquo;
1414
{% trans 'Delete' %}
1515
</div>
1616
{% endbreadcrumb_scope %}{% endblock %}

0 commit comments

Comments
 (0)