diff --git a/src/registrar/config/urls.py b/src/registrar/config/urls.py index c21d0206c..0f136c932 100644 --- a/src/registrar/config/urls.py +++ b/src/registrar/config/urls.py @@ -4,7 +4,6 @@ For more information see: https://docs.djangoproject.com/en/4.0/topics/http/urls/ """ -from django.conf import settings from django.contrib import admin from django.urls import include, path from django.views.generic import RedirectView @@ -45,6 +44,10 @@ for step, view in [ urlpatterns = [ path("", views.index, name="home"), + path( + "admin/logout/", + RedirectView.as_view(pattern_name="logout", permanent=False), + ), path("admin/", admin.site.urls), path( "application//edit/", @@ -114,20 +117,6 @@ urlpatterns = [ ), ] - -if not settings.DEBUG: - urlpatterns += [ - # redirect to login.gov - path( - "admin/login/", RedirectView.as_view(pattern_name="login", permanent=False) - ), - # redirect to login.gov - path( - "admin/logout/", - RedirectView.as_view(pattern_name="logout", permanent=False), - ), - ] - # we normally would guard these with `if settings.DEBUG` but tests run with # DEBUG = False even when these apps have been loaded because settings.DEBUG # was actually True. Instead, let's add these URLs any time we are able to diff --git a/src/registrar/templates/admin/base_site.html b/src/registrar/templates/admin/base_site.html index 9be44e43f..6b641722f 100644 --- a/src/registrar/templates/admin/base_site.html +++ b/src/registrar/templates/admin/base_site.html @@ -1,5 +1,6 @@ {% extends "admin/base.html" %} {% load static %} +{% load i18n %} {% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} @@ -13,5 +14,25 @@ {% include "admin/color_theme_toggle.html" %} {% endif %} {% endblock %} - +{% comment %} + This was copied from the 'userlinks' template, with a few minor changes. + You can find that here: + https://github.com/django/django/blob/d25f3892114466d689fd6936f79f3bd9a9acc30e/django/contrib/admin/templates/admin/base.html#L59 +{% endcomment %} +{% block userlinks %} + {% if site_url %} + {% translate 'View site' %} / + {% endif %} + {% if user.is_active and user.is_staff %} + {% url 'django-admindocs-docroot' as docsroot %} + {% if docsroot %} + {% translate 'Documentation' %} / + {% endif %} + {% endif %} + {% if user.has_usable_password %} + {% translate 'Change password' %} / + {% endif %} + {% translate 'Log out' %} + {% include "admin/color_theme_toggle.html" %} + {% endblock %} {% block nav-global %}{% endblock %} \ No newline at end of file