diff --git a/backend/custom_admin/templates/admin/django_base.html b/backend/custom_admin/templates/admin/django_base.html index f01a7ab61c..b8330c02f5 100644 --- a/backend/custom_admin/templates/admin/django_base.html +++ b/backend/custom_admin/templates/admin/django_base.html @@ -1,30 +1,32 @@ -{% load i18n static %} +{% load i18n static tz %} {% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %} {% block title %}{% endblock %} - + + {% block dark-mode-vars %} - - + + {% endblock %} {% if not is_popup and is_nav_sidebar_enabled %} - - + + {% endif %} {% block extrastyle %}{% endblock %} -{% if LANGUAGE_BIDI %}{% endif %} +{% if LANGUAGE_BIDI %}{% endif %} {% block extrahead %}{% endblock %} {% block responsive %} - - {% if LANGUAGE_BIDI %}{% endif %} + + {% if LANGUAGE_BIDI %}{% endif %} {% endblock %} {% block blockbots %}{% endblock %} + data-admin-utc-offset="{% now "Z" %}" + data-admin-server-timezone="{% get_current_timezone as time_zone %}{{ time_zone }}"> {% translate 'Skip to main content' %}
@@ -72,10 +74,10 @@ {% block nav-breadcrumbs %} {% endblock %} @@ -97,11 +99,15 @@ {% endblock messages %}
- {% block pretitle %}{% endblock %} - {% block content_title %}{% if title %}

{{ title }}

{% endif %}{% endblock %} - {% block content_subtitle %}{% if subtitle %}

{{ subtitle }}

{% endif %}{% endblock %} - {% block content %} +
+
+ {% block pretitle %}{% endblock %} + {% block content_title %}{% if title %}

{{ title }}

{% endif %}{% endblock %} + {% block content_subtitle %}{% if subtitle %}

{{ subtitle }}

{% endif %}{% endblock %} +
{% block object-tools %}{% endblock %} +
+ {% block content %} {{ content }} {% endblock %} {% block sidebar %}{% endblock %} @@ -116,10 +122,11 @@ - - - + + + +{% block extrabody %}{% endblock extrabody %} diff --git a/backend/custom_admin/tests/test_template_backends.py b/backend/custom_admin/tests/test_template_backends.py index d693e153e1..bed4233e5c 100644 --- a/backend/custom_admin/tests/test_template_backends.py +++ b/backend/custom_admin/tests/test_template_backends.py @@ -1,5 +1,6 @@ import pytest from unittest.mock import Mock, mock_open, patch +from django.urls import reverse from custom_admin.template_backends import ( AstroContentLoader, CustomAdminDjangoTemplate, @@ -76,3 +77,19 @@ def test_astro_content_loader_ignores_non_admin_base_templates(settings, templat loader = AstroContentLoader(engine=Mock()) with pytest.raises(StopIteration): next(loader.get_template_sources(template_name)) + + +def test_admin_changelist_shows_object_tools( + client, admin_superuser, requests_mock, settings +): + settings.DEBUG = True + requests_mock.get( + "http://127.0.0.1:8000/astro/admin-base.html", + text="{% extends 'admin/pycon_base.html' %}", + ) + client.force_login(admin_superuser) + + response = client.get(reverse("admin:conferences_topic_changelist")) + + assert response.status_code == 200 + assert '