Skip to content

Commit b890718

Browse files
trumpet2012tim-schilling
authored andcommitted
\#527 Fixes issue where the history button doesn't work when viewing a historical entry
1 parent 7cd4647 commit b890718

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Authors
146146
- `DanialErfanian <https://github.com/DanialErfanian>`_
147147
- `Sridhar Marella <https://github.com/sridhar562345>`_
148148
- `Mattia Fantoni <https://github.com/MattFanto>`_
149+
- `Trent Holliday <https://github.com/trumpet2012>`_
149150

150151
Background
151152
==========

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Unreleased
1313
- Dropped support for Python 3.8, which reached end-of-life on 2024-10-07 (gh-1421)
1414
- Added support for Django 5.1 (gh-1388)
1515
- Added pagination to ``SimpleHistoryAdmin`` (gh-1277)
16+
- Fixed issue with history button not working when viewing historical entries in the
17+
admin (gh-527)
1618

1719
3.7.0 (2024-05-29)
1820
------------------

simple_history/templates/simple_history/object_history_form.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% extends "admin/change_form.html" %}
2-
{% load i18n %}
2+
{% load i18n admin_urls %}
33
{% load url from simple_history_compat %}
44

55
{% block breadcrumbs %}
@@ -21,6 +21,14 @@
2121
{% include "simple_history/submit_line.html" %}
2222
{% endblock %}
2323

24+
{% block object-tools-items %}
25+
{# We override this block from the django template to fix up the history link #}
26+
<li>
27+
<a href="{% add_preserved_filters history_url %}" class="historylink">{% translate "History" %}</a>
28+
</li>
29+
{% if has_absolute_url %}<li><a href="{{ absolute_url }}" class="viewsitelink">{% translate "View on site" %}</a></li>{% endif %}
30+
{% endblock %}
31+
2432
{% block form_top %}
2533
<p>{% if not revert_disabled %}{% blocktrans %}Press the 'Revert' button below to revert to this version of the object.{% endblocktrans %}{% endif %}{% if change_history %}{% blocktrans %}Press the 'Change History' button below to edit the history.{% endblocktrans %}{% endif %}</p>
2634
{% endblock %}

0 commit comments

Comments
 (0)