Ticket #930: ordering_foreignkey.diff

File ordering_foreignkey.diff, 699 bytes (added by dodysw@…, 19 years ago)
  • django/contrib/admin/views/main.py

     
    203203               f = lookup_opts.get_field(order_field)
    204204               rel_ordering = f.rel.to.ordering and f.rel.to.ordering[0] or f.rel.to.pk.column
    205205               lookup_order_field = '%s.%s' % (f.rel.to.db_table, rel_ordering)
     206                lookup_params['select_related'] = True
    206207       # Use select_related if one of the list_display options is a field with a
    207208       # relationship.
    208209       if lookup_opts.admin.list_select_related:
Back to Top