summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Rosner <brosner@gmail.com>2008-08-25 03:55:47 +0000
committerBrian Rosner <brosner@gmail.com>2008-08-25 03:55:47 +0000
commitde977c851429974f90ba907332c1d8699b88b4da (patch)
treec87d060f81e6b1b3e1e28d890d30c920919a4d6b
parent82a1d5471cba138d90b5bb99d8313486af06d56a (diff)
Fixed #8522 -- Allow app_index to take extra_context to be consistent with the other views in the admin. Thanks Jannis Leidel for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8529 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/admin/sites.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index dfeb8a4add..25ce375ea7 100644
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -366,7 +366,7 @@ class AdminSite(object):
context_instance=template.RequestContext(request)
)
- def app_index(self, request, app_label):
+ def app_index(self, request, app_label, extra_context=None):
user = request.user
has_module_perms = user.has_module_perms(app_label)
app_dict = {}
@@ -399,10 +399,14 @@ class AdminSite(object):
raise http.Http404('The requested admin page does not exist.')
# Sort the models alphabetically within each app.
app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name']))
- return render_to_response(self.app_index_template or 'admin/app_index.html', {
+ context = {
'title': _('%s administration' % capfirst(app_label)),
'app_list': [app_dict]
- }, context_instance=template.RequestContext(request))
+ }
+ context.update(extra_context or {})
+ return render_to_response(self.app_index_template or 'admin/app_index.html', context,
+ context_instance=template.RequestContext(request)
+ )
# This global object represents the default admin site, for the common case.
# You can instantiate AdminSite in your own code to create a custom admin site.