[Changeset] r8529 - django/trunk/django/contrib/admin

0 views
Skip to first unread message

nor...@djangoproject.com

unread,
Aug 24, 2008, 11:55:48 PM8/24/08
to django-...@googlegroups.com
Author: brosner
Date: 2008-08-24 22:55:47 -0500 (Sun, 24 Aug 2008)
New Revision: 8529

Modified:
django/trunk/django/contrib/admin/sites.py
Log:
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.

Modified: django/trunk/django/contrib/admin/sites.py
===================================================================
--- django/trunk/django/contrib/admin/sites.py 2008-08-25 03:51:25 UTC (rev 8528)
+++ django/trunk/django/contrib/admin/sites.py 2008-08-25 03:55:47 UTC (rev 8529)
@@ -366,7 +366,7 @@
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 @@
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.

Reply all
Reply to author
Forward
0 new messages