Ticket #4926: ticket_4926_changelist_multifield_ordering.diff

File ticket_4926_changelist_multifield_ordering.diff, 705 bytes (added by Eric B <ebartels@…>, 17 years ago)
  • django/contrib/admin/views/main.py

    diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
    index 254f202..421c11a 100644
    a b class ChangeList(object):  
    225225        # manually-specified ordering from the query string.
    226226        ordering = self.model_admin.ordering or lookup_opts.ordering or ['-' + lookup_opts.pk.name]
    227227
    228         if ordering[0].startswith('-'):
     228        if len(ordering) > 1:
     229            order_field, order_type = '', ''
     230        elif ordering[0].startswith('-'):
    229231            order_field, order_type = ordering[0][1:], 'desc'
    230232        else:
    231233            order_field, order_type = ordering[0], 'asc'
Back to Top