Author: mtredinnick
Date: 2007-04-26 09:58:38 -0500 (Thu, 26 Apr 2007)
New Revision: 5097
Modified:
django/trunk/django/contrib/admin/views/main.py
Log:
Revert [5092], since this should only have been applied to newforms-admin.
Refs #1576.
Modified: django/trunk/django/contrib/admin/views/main.py
===================================================================
--- django/trunk/django/contrib/admin/views/main.py 2007-04-26 14:58:18 UTC
(rev 5096)
+++ django/trunk/django/contrib/admin/views/main.py 2007-04-26 14:58:38 UTC
(rev 5097)
@@ -707,7 +707,6 @@
# If the order-by field is a field with a relationship, order by the
# value in the related table.
lookup_order_field = self.order_field
- order_type = self.order_type == 'desc' and '-' or ''
try:
f = self.lookup_opts.get_field(self.order_field,
many_to_many=False)
except models.FieldDoesNotExist:
@@ -718,18 +717,10 @@
pass
elif isinstance(f.rel, models.ManyToOneRel):
rel_ordering = f.rel.to._meta.ordering and
f.rel.to._meta.ordering[0] or f.rel.to._meta.pk.column
- if rel_ordering[0] == '-':
- rel_ordering = rel_ordering[1:]
- order_type = not order_type and '-' or ''
lookup_order_field = '%s.%s' % (f.rel.to._meta.db_table,
rel_ordering)
- # Must select related because the lookup field may be in a
- # table not otherwise referenced yet.
- # FIXME: Try to remove the need for this in the QuerySet
- # refactor.
- qs = qs.select_related()
# Set ordering.
- qs = qs.order_by('%s%s' % (order_type, lookup_order_field))
+ qs = qs.order_by((self.order_type == 'desc' and '-' or '') +
lookup_order_field)
# Apply keyword searches.
def construct_search(field_name):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---