Used url template tag for history

This commit is contained in:
PhilippTh 2026-03-17 08:38:01 +01:00
parent e0d406d0a4
commit e760dcc80f
2 changed files with 5 additions and 2 deletions

View file

@ -24,7 +24,7 @@
{% block content %}
<ul class="object-tools">
<li><a href="history/" class="historylink">{% trans 'History' %}</a></li>
<li><a href="{% url 'admin:constance_config_history' %}" class="historylink">{% trans 'History' %}</a></li>
</ul>
<div id="content-main" class="constance">
<div class="module" id="changelist">

View file

@ -448,12 +448,15 @@ class TestAdmin(TestCase):
def test_changelist_has_history_link(self):
"""Test that the changelist page contains a link to the history view."""
from django.urls import reverse
request = self.rf.get("/admin/constance/config/")
request.user = self.superuser
response = self.options.changelist_view(request)
response.render()
content = response.content.decode()
self.assertIn('href="history/"', content)
history_url = reverse("admin:constance_config_history")
self.assertIn(f'href="{history_url}"', content)
self.assertIn("History", content)
def test_change_url_redirects_to_changelist(self):