Commit a81af7f4 authored by areski's avatar areski Committed by Tim Graham
Browse files

Fixed #13749 -- Added link from admin site to front-end site.

Thanks romankrv for the suggestion.
parent 6aae07fe
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ class AdminSite(object):
    # Text to put at the top of the admin index page.
    index_title = ugettext_lazy('Site administration')

    # URL for the "View site" link at the top of each admin page.
    site_url = '/'

    login_form = None
    index_template = None
    app_index_template = None
@@ -272,6 +275,7 @@ class AdminSite(object):
        return {
            'site_title': self.site_title,
            'site_header': self.site_header,
            'site_url': self.site_url,
        }

    def password_change(self, request):
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@
                <strong>{% firstof user.get_short_name user.get_username %}</strong>.
            {% endblock %}
            {% block userlinks %}
                {% if site_url %}
                    <a href="{{ site_url }}">{% trans 'View site' %}</a> /
                {% endif %}
                {% url 'django-admindocs-docroot' as docsroot %}
                {% if docsroot %}
                    <a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
+7 −0
Original line number Diff line number Diff line
@@ -2445,6 +2445,13 @@ Templates can override or extend base admin templates as described in
    The text to put at the end of each admin page's ``<title>`` (a string). By
    default, this is "Django site admin".

.. attribute:: AdminSite.site_url

    .. versionadded:: 1.8

    The URL for the "View site" link at the top of each admin page. By default,
    ``site_url`` is ``/``. Set it to ``None`` to remove the link.

.. attribute:: AdminSite.index_title

    .. versionadded:: 1.7
+4 −0
Original line number Diff line number Diff line
@@ -50,6 +50,10 @@ Minor features

* The jQuery library embedded in the admin has been upgraded to version 1.11.1.

* You can now specify :attr:`AdminSite.site_url
  <django.contrib.admin.AdminSite.site_url>` in order to display a link to the
  front-end site.

:mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^

+1 −0
Original line number Diff line number Diff line
@@ -832,6 +832,7 @@ class FunkyTagAdmin(admin.ModelAdmin):


site = admin.AdminSite(name="admin")
site.site_url = '/my-site-url/'
site.register(Article, ArticleAdmin)
site.register(CustomArticle, CustomArticleAdmin)
site.register(Section, save_as=True, inlines=[ArticleInline])
Loading