Repository: jazzband/django-simple-history

Issue:
admin.site.site_header not respected
If admin.site.site_header is set in urls.py, displaying the history will not respect that and still display "Django administration" as a header.



Discussion:
This fix just requires adding `self.admin_site.each_context(request)` to the context within `history_view` and within `history_form_view` on the admin. Good first issue for someone looking to contribute. Will require fixing some tests as well. Django's history view is linked (here)[https://docs.djangoproject.com/en/2.0/_modules/django/contrib/admin/options/#ModelAdmin.history_view]

Resolving patch:
diff --git a/simple_history/admin.py b/simple_history/admin.py
--- a/simple_history/admin.py
+++ b/simple_history/admin.py
@@ -84,6 +84,7 @@ def history_view(self, request, object_id, extra_context=None):
             'admin_user_view': admin_user_view,
             'history_list_display': history_list_display,
         }
+        context.update(self.admin_site.each_context(request))
         context.update(extra_context or {})
         extra_kwargs = {}
         return render(request, self.object_history_template, context,
@@ -189,6 +190,7 @@ def history_form_view(self, request, object_id, version_id):
             'save_on_top': self.save_on_top,
             'root_path': getattr(self.admin_site, 'root_path', None),
         }
+        context.update(self.admin_site.each_context(request))
         extra_kwargs = {}
         return render(request, self.object_history_form_template, context,
                       **extra_kwargs)


Test patch:
diff --git a/simple_history/tests/tests/test_admin.py b/simple_history/tests/tests/test_admin.py
--- a/simple_history/tests/tests/test_admin.py
+++ b/simple_history/tests/tests/test_admin.py
@@ -467,6 +467,7 @@ def test_history_form_view_without_getting_history(self):
             'save_on_top': admin.save_on_top,
             'root_path': getattr(admin_site, 'root_path', None),
         }
+        context.update(admin_site.each_context(request))
         mock_render.assert_called_once_with(
             request, admin.object_history_form_template, context)
 
@@ -522,6 +523,7 @@ def test_history_form_view_getting_history(self):
             'save_on_top': admin.save_on_top,
             'root_path': getattr(admin_site, 'root_path', None),
         }
+        context.update(admin_site.each_context(request))
         mock_render.assert_called_once_with(
             request, admin.object_history_form_template, context)
 
@@ -576,6 +578,7 @@ def test_history_form_view_getting_history_with_setting_off(self):
             'save_on_top': admin.save_on_top,
             'root_path': getattr(admin_site, 'root_path', None),
         }
+        context.update(admin_site.each_context(request))
         mock_render.assert_called_once_with(
             request, admin.object_history_form_template, context)
 
@@ -632,5 +635,6 @@ def test_history_form_view_getting_history_abstract_external(self):
             'save_on_top': admin.save_on_top,
             'root_path': getattr(admin_site, 'root_path', None),
         }
+        context.update(admin_site.each_context(request))
         mock_render.assert_called_once_with(
             request, admin.object_history_form_template, context)