From 48ce09f2f658c539fa6be4c223bca1b51146241d Mon Sep 17 00:00:00 2001 From: Bouke Haarsma Date: Tue, 5 Nov 2013 11:49:16 +0100 Subject: [PATCH] Fixed missing admindocs' site_header --- django/contrib/admindocs/views.py | 4 +++- tests/admin_docs/tests.py | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py index b4caff82c7b..482d33e76f7 100644 --- a/django/contrib/admindocs/views.py +++ b/django/contrib/admindocs/views.py @@ -5,6 +5,7 @@ import re from django import template from django.conf import settings +from django.contrib import admin from django.contrib.admin.views.decorators import staff_member_required from django.db import models from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist @@ -36,11 +37,12 @@ class BaseAdminDocsView(TemplateView): if not utils.docutils_is_available: # Display an error message for people without docutils self.template_name = 'admin_doc/missing_docutils.html' - return self.render_to_response({}) + return self.render_to_response(admin.site.each_context()) return super(BaseAdminDocsView, self).dispatch(*args, **kwargs) def get_context_data(self, **kwargs): kwargs.update({'root_path': urlresolvers.reverse('admin:index')}) + kwargs.update(admin.site.each_context()) return super(BaseAdminDocsView, self).get_context_data(**kwargs) diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py index d43205987ea..0d4bcbd998f 100644 --- a/tests/admin_docs/tests.py +++ b/tests/admin_docs/tests.py @@ -25,6 +25,9 @@ class AdminDocViewTests(TestCase): self.client.login(username='super', password='secret') response = self.client.get(reverse('django-admindocs-docroot')) self.assertContains(response, '

Documentation

', html=True) + self.assertContains(response, + '

Django ' + 'administration

') def test_bookmarklets(self): response = self.client.get(reverse('django-admindocs-bookmarklets')) @@ -80,6 +83,9 @@ class AdminDocViewTests(TestCase): '

The admin documentation system requires Python\'s ' 'docutils library.

', html=True) + self.assertContains(response, + '

Django ' + 'administration

') finally: utils.docutils_is_available = True