﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
157	view/admin/main.py change_list assumes orderlist is tuple	mfenniak@…	Adrian Holovaty	"In the function change_list in views/admin/main.py, an assumption is made that the ""ordering"" variable will be a tuple.  The orderlist can be a single string, according to the behaviour built in meta.handle_legacy_orderlist.  As a result of this, the code around line 106 seems incorrect, as it assumes an indexable array.  Since a string actually is an indexable array, no error is thrown immediately.

The following patch restores my admin pages to working order, but it may not be the best way to handle this.

{{{
Index: django/views/admin/main.py
===================================================================
--- django/views/admin/main.py  (revision 293)
+++ django/views/admin/main.py  (working copy)
@@ -98,6 +98,9 @@
 
     # Normalize it to new-style ordering.
     ordering = meta.handle_legacy_orderlist(ordering)
+    if isinstance(ordering, basestring):
+        # tupelize it
+        ordering = (ordering,)
 
     if ordering[0].startswith('-'):
         order_field, order_type = ordering[0][1:], 'DESC'
}}}"	defect	closed	contrib.admin		normal	fixed			Accepted	0	0	0	0	0	0
