Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

admin: view site link #2809

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+14 −0
Split
@@ -31,6 +31,9 @@
<strong>{% firstof user.get_short_name user.get_username %}</strong>.
{% endblock %}
{% block userlinks %}
+ {% block userlinks_viewsite %}
+ <a href="/">{% trans 'View site' %}</a> /
+ {% endblock %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
View
@@ -35,6 +35,9 @@ Minor features
:meth:`~django.contrib.admin.ModelAdmin.has_module_permission`
method to allow limiting access to the module on the admin index page.
+* the admin template now has a ``View site`` link that links to ``/`` in the upper right corner of the page.
+ the default behaviour can be customized by overriding the ``userlinks_viewsite`` block which is contained in the ``base.html`` template.
+
:mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -698,6 +698,14 @@ def test_proxy_model_content_type_is_used_for_log_entries(self):
color2_delete_log = LogEntry.objects.all()[0]
self.assertEqual(color2_content_type, color2_delete_log.content_type)
+
+ def test_view_site_link(self):
+ """
+ Ensure there is a view site link
+ """
+ url = reverse('admin:index')
+ response = self.client.get(url)
+ self.assertContains(response, 'View site')
@override_settings(TEMPLATE_DIRS=ADMIN_VIEW_TEMPLATES_DIR)