Ticket #1245: admin_views_main.diff
File admin_views_main.diff, 936 bytes (added by , 19 years ago) |
---|
-
django/contrib/admin/views/main.py
199 199 except meta.FieldDoesNotExist: 200 200 pass 201 201 else: 202 if isinstance(lookup_opts.get_field(order_field).rel, meta.ManyToOneRel): 203 f = lookup_opts.get_field(order_field) 202 f = lookup_opts.get_field(order_field) 203 if isinstance(f.rel, meta.OneToOneRel): 204 lookup_order_field = '%s' % (f.column,) 205 elif isinstance(f.rel, meta.ManyToOneRel): 204 206 rel_ordering = f.rel.to.ordering and f.rel.to.ordering[0] or f.rel.to.pk.column 205 207 lookup_order_field = '%s.%s' % (f.rel.to.db_table, rel_ordering) 206 208 # Use select_related if one of the list_display options is a field with a