Opened 12 years ago

Last modified 11 years ago

#18697 closed Bug

django.contrib.admin.AdminSite should not pass a sequence as the template to TemplateResponse — at Initial Version

Reported by: and@… Owned by: nobody
Component: contrib.admin Version: 1.4
Severity: Normal Keywords:
Cc: travis@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This appears to be a simple coding error.

I have code (mobile-admin) that sets index_template to ['admin/index.html', 'index.html']. The current call ends up passing admin/index.html', 'index.html to TemplateResponse, which fails with a TypeError trying to use ['admin/index.html', 'index.html'] as a template.

The following patch fixes this issue:

root@host:/usr/share/pyshared/django/contrib/admin# diff -uw sites.py{.orig,}
--- sites.py.orig	2012-03-23 12:59:19.000000000 -0400
+++ sites.py	2012-08-01 18:18:55.000000000 -0400
@@ -381,9 +381,9 @@
             'app_list': app_list,
         }
         context.update(extra_context or {})
-        return TemplateResponse(request, [
+        return TemplateResponse(request,
             self.index_template or 'admin/index.html',
-        ], context, current_app=self.name)
+            context, current_app=self.name)
 
     def app_index(self, request, app_label, extra_context=None):
         user = request.user

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top