Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Revert [5092], since this should only have been applied to newforms-a…

…dmin.

Refs #1576.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5097 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4bce3c17ec8ca896e376dc85e02e0288117bcf2a 1 parent 38d8e84
Malcolm Tredinnick authored April 26, 2007

Showing 1 changed file with 1 addition and 10 deletions. Show diff stats Hide diff stats

  1. 11  django/contrib/admin/views/main.py
11  django/contrib/admin/views/main.py
@@ -707,7 +707,6 @@ def get_query_set(self):
707 707
         # If the order-by field is a field with a relationship, order by the
708 708
         # value in the related table.
709 709
         lookup_order_field = self.order_field
710  
-        order_type = self.order_type == 'desc' and '-' or ''
711 710
         try:
712 711
             f = self.lookup_opts.get_field(self.order_field, many_to_many=False)
713 712
         except models.FieldDoesNotExist:
@@ -718,18 +717,10 @@ def get_query_set(self):
718 717
                 pass
719 718
             elif isinstance(f.rel, models.ManyToOneRel):
720 719
                 rel_ordering = f.rel.to._meta.ordering and f.rel.to._meta.ordering[0] or f.rel.to._meta.pk.column
721  
-                if rel_ordering[0] == '-':
722  
-                    rel_ordering = rel_ordering[1:]
723  
-                    order_type = not order_type and '-' or ''
724 720
                 lookup_order_field = '%s.%s' % (f.rel.to._meta.db_table, rel_ordering)
725  
-                # Must select related because the lookup field may be in a
726  
-                # table not otherwise referenced yet.
727  
-                # FIXME: Try to remove the need for this in the QuerySet
728  
-                # refactor.
729  
-                qs = qs.select_related()
730 721
 
731 722
         # Set ordering.
732  
-        qs = qs.order_by('%s%s' % (order_type, lookup_order_field))
  723
+        qs = qs.order_by((self.order_type == 'desc' and '-' or '') + lookup_order_field)
733 724
 
734 725
         # Apply keyword searches.
735 726
         def construct_search(field_name):

0 notes on commit 4bce3c1

Please sign in to comment.
Something went wrong with that request. Please try again.