Ticket #4926: ticket_4926_changelist_multifield_ordering_r12379.2.diff

File ticket_4926_changelist_multifield_ordering_r12379.2.diff, 1.3 KB (added by Antti Kaihola, 15 years ago)

also removes the related admonition from contrib.admin documentation

  • 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'
  • docs/ref/contrib/admin/index.txt

    diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
    index cacadfd..2511033 100644
    a b ordered. This should be a list or tuple in the same format as a model's  
    498498
    499499If this isn't provided, the Django admin will use the model's default ordering.
    500500
    501 .. admonition:: Note
    502 
    503     Django will only honor the first element in the list/tuple; any others
    504     will be ignored.
    505 
    506501.. attribute:: ModelAdmin.prepopulated_fields
    507502
    508503Set ``prepopulated_fields`` to a dictionary mapping field names to the fields
Back to Top