From 79026a6e224250612c76ecf8cfa33c519983e70e Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 22 Jul 2005 17:58:56 +0000 Subject: [PATCH] Fixed #156 -- Fixed admin changelist bug as a result of ordering syntax change git-svn-id: http://code.djangoproject.com/svn/django/trunk@296 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/admin/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/views/admin/main.py b/django/views/admin/main.py index 45d044727d..5c9ed69dd3 100644 --- a/django/views/admin/main.py +++ b/django/views/admin/main.py @@ -94,7 +94,7 @@ def change_list(request, app_label, module_name): # then check the object's default ordering. If neither of those exist, # order descending by ID by default. Finally, look for manually-specified # ordering from the query string. - ordering = lookup_opts.admin.ordering or lookup_opts.ordering or ('-' + lookup_opts.pk.name) + ordering = lookup_opts.admin.ordering or lookup_opts.ordering or ['-' + lookup_opts.pk.name] # Normalize it to new-style ordering. ordering = meta.handle_legacy_orderlist(ordering) @@ -140,7 +140,7 @@ def change_list(request, app_label, module_name): if isinstance(f.rel, meta.ManyToOne): lookup_params['select_related'] = True break - lookup_params['order_by'] = ((lookup_order_field, order_type),) + lookup_params['order_by'] = ((order_type == 'DESC' and '-' or '') + lookup_order_field,) if lookup_opts.admin.search_fields and query: or_queries = [] for bit in query.split():