Ticket #4926: ticket_4926_changelist_multifield_ordering_r12379.diff

File ticket_4926_changelist_multifield_ordering_r12379.diff, 705 bytes (added by Antti Kaihola, 15 years ago)

patch against current trunk, otherwise unmodified

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

    diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
    index df0fd9f..b2ba2ed 100644
    a b class ChangeList(object):  
    138138        # manually-specified ordering from the query string.
    139139        ordering = self.model_admin.ordering or lookup_opts.ordering or ['-' + lookup_opts.pk.name]
    140140
    141         if ordering[0].startswith('-'):
     141        if len(ordering) > 1:
     142            order_field, order_type = '', ''
     143        elif ordering[0].startswith('-'):
    142144            order_field, order_type = ordering[0][1:], 'desc'
    143145        else:
    144146            order_field, order_type = ordering[0], 'asc'
Back to Top