Ticket #20372: ticket_20372.diff

File ticket_20372.diff, 2.2 KB (added by d1ffuz0r, 2 years ago)

use another template for logout in admin interface

  • django/contrib/admin/sites.py

    diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
    index 414d1b4..6c76bcb 100644
    a b class AdminSite(object): 
    309309        defaults = {
    310310            'current_app': self.name,
    311311            'extra_context': extra_context or {},
     312            'template_name': self.logout_template or 'admin/logged_out.html'
    312313        }
    313         if self.logout_template is not None:
    314             defaults['template_name'] = self.logout_template
    315314        return logout(request, **defaults)
    316315
    317316    @never_cache
  • new file django/contrib/admin/templates/admin/logged_out.html

    diff --git a/django/contrib/admin/templates/admin/logged_out.html b/django/contrib/admin/templates/admin/logged_out.html
    new file mode 100644
    index 0000000..6a18186
    - +  
     1{% extends "admin/base_site.html" %}
     2{% load i18n %}
     3
     4{% block breadcrumbs %}<div class="breadcrumbs"><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></div>{% endblock %}
     5
     6{% block content %}
     7
     8<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
     9
     10<p><a href="{% url 'admin:index' %}">{% trans 'Log in again' %}</a></p>
     11
     12{% endblock %}
  • tests/admin_views/tests.py

    diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
    index 8e678a7..01cd01f 100644
    a b class AdminViewLogoutTest(TestCase): 
    39943994    def test_client_logout_url_can_be_used_to_login(self):
    39953995        response = self.client.get('/test_admin/admin/logout/')
    39963996        self.assertEqual(response.status_code, 200)
    3997         self.assertTemplateUsed(response, 'registration/logged_out.html')
     3997        self.assertTemplateUsed(response, 'admin/logged_out.html')
    39983998        self.assertEqual(response.request['PATH_INFO'], '/test_admin/admin/logout/')
    39993999
    40004000        # we are now logged out
  • tests/templates/custom_admin/logout.html

    diff --git a/tests/templates/custom_admin/logout.html b/tests/templates/custom_admin/logout.html
    index 3a9301b..bc37a6c 100644
    a b  
    1 {% extends "registration/logged_out.html" %}
     1{% extends "admin/logged_out.html" %}
    22
    33{% block content %}
    44Hello from a custom logout template
Back to Top