From aee9eecb920cf281e8339a5f7edadc6f2dd04fea Mon Sep 17 00:00:00 2001 From: Daniel Hepper Date: Fri, 8 Jun 2012 12:32:16 +0200 Subject: [PATCH] Fixed #18444 -- Replace hard coded "View on Site" URLs --- django/contrib/admin/sites.py | 3 ++- .../admin/templates/admin/change_form.html | 2 +- .../templates/admin/edit_inline/stacked.html | 2 +- .../templates/admin/edit_inline/tabular.html | 2 +- docs/ref/contrib/admin/index.txt | 21 ++++++++++--------- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 4bb64408773..515cc33eca6 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -231,7 +231,8 @@ class AdminSite(object): wrap(self.i18n_javascript, cacheable=True), name='jsi18n'), url(r'^r/(?P\d+)/(?P.+)/$', - wrap(contenttype_views.shortcut)), + wrap(contenttype_views.shortcut), + name='view_on_site'), url(r'^(?P\w+)/$', wrap(self.app_index), name='app_list') diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index fd549246159..82d7296c858 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -30,7 +30,7 @@ {% endif %}{% endif %} diff --git a/django/contrib/admin/templates/admin/edit_inline/stacked.html b/django/contrib/admin/templates/admin/edit_inline/stacked.html index 55463d97b14..d57d3dad491 100644 --- a/django/contrib/admin/templates/admin/edit_inline/stacked.html +++ b/django/contrib/admin/templates/admin/edit_inline/stacked.html @@ -6,7 +6,7 @@ {% for inline_admin_form in inline_admin_formset %}

{{ inline_admin_formset.opts.verbose_name|title }}: {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %}#{{ forloop.counter }}{% endif %} - {% if inline_admin_form.show_url %}{% trans "View on site" %}{% endif %} + {% if inline_admin_form.show_url %}{% trans "View on site" %}{% endif %} {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}{% endif %}

{% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %} diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index d5ac9b0fb69..4f491538199 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -27,7 +27,7 @@ {% if inline_admin_form.original or inline_admin_form.show_url %}

{% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %} - {% if inline_admin_form.show_url %}{% trans "View on site" %}{% endif %} + {% if inline_admin_form.show_url %}{% trans "View on site" %}{% endif %}

{% endif %} {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %} {{ inline_admin_form.fk_field.field }} diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 3ef9abe6da7..7aca0981c33 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1948,16 +1948,17 @@ accessible using Django's :ref:`URL reversing system `. The :class:`AdminSite` provides the following named URL patterns: -====================== ======================== ============= -Page URL name Parameters -====================== ======================== ============= -Index ``index`` -Logout ``logout`` -Password change ``password_change`` -Password change done ``password_change_done`` -i18n javascript ``jsi18n`` -Application index page ``app_list`` ``app_label`` -====================== ======================== ============= +========================= ======================== ================================== +Page URL name Parameters +========================= ======================== ================================== +Index ``index`` +Logout ``logout`` +Password change ``password_change`` +Password change done ``password_change_done`` +i18n javascript ``jsi18n`` +Application index page ``app_list`` ``app_label`` +Redirect to object's page ``view_on_site`` ``content_type_id``, ``object_id`` +========================= ======================== ================================== Each :class:`ModelAdmin` instance provides an additional set of named URLs: