Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit de977c851429974f90ba907332c1d8699b88b4da 1 parent 82a1d54
@brosner brosner authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 django/contrib/admin/sites.py
View
10 django/contrib/admin/sites.py
@@ -366,7 +366,7 @@ def display_login_form(self, request, error_message='', extra_context=None):
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 @@ def app_index(self, request, app_label):
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.
Please sign in to comment.
Something went wrong with that request. Please try again.