Ticket #5057: admin_ordering.diff

File admin_ordering.diff, 739 bytes (added by Robert Myers <myer0052@…>, 17 years ago)

related ordering patch for admin interface

  • django/contrib/admin/views/main.py

     
    729729                pass
    730730            elif isinstance(f.rel, models.ManyToOneRel):
    731731                rel_ordering = f.rel.to._meta.ordering and f.rel.to._meta.ordering[0] or f.rel.to._meta.pk.column
     732                if rel_ordering.startswith('-'):
     733                    rel_ordering = rel_ordering[1:]
     734                    self.order_type = (self.order_type == 'desc' and 'asc' or 'desc')
    732735                lookup_order_field = '%s.%s' % (f.rel.to._meta.db_table, rel_ordering)
    733736
    734737        # Set ordering.
Back to Top