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
This commit is contained in:
parent
f1f952761e
commit
79026a6e22
|
@ -94,7 +94,7 @@ def change_list(request, app_label, module_name):
|
||||||
# then check the object's default ordering. If neither of those exist,
|
# then check the object's default ordering. If neither of those exist,
|
||||||
# order descending by ID by default. Finally, look for manually-specified
|
# order descending by ID by default. Finally, look for manually-specified
|
||||||
# ordering from the query string.
|
# 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.
|
# Normalize it to new-style ordering.
|
||||||
ordering = meta.handle_legacy_orderlist(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):
|
if isinstance(f.rel, meta.ManyToOne):
|
||||||
lookup_params['select_related'] = True
|
lookup_params['select_related'] = True
|
||||||
break
|
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:
|
if lookup_opts.admin.search_fields and query:
|
||||||
or_queries = []
|
or_queries = []
|
||||||
for bit in query.split():
|
for bit in query.split():
|
||||||
|
|
Loading…
Reference in New Issue