Ticket #3742: admin_order_fields_desc.diff

File admin_order_fields_desc.diff, 589 bytes (added by matt <matt.barry@…>, 18 years ago)

Bidirectional change list sorting for sortable non-fields

  • admin_list.py

     
    101101
    102102        th_classes = []
    103103        new_order_type = 'asc'
    104         if field_name == cl.order_field:
     104        order_field = getattr(getattr(cl.model, field_name, None), "admin_order_field", None)
     105        if cl.order_field in (order_field, field_name):
    105106            th_classes.append('sorted %sending' % cl.order_type.lower())
    106107            new_order_type = {'asc': 'desc', 'desc': 'asc'}[cl.order_type.lower()]
    107108
Back to Top