Fixed #7582: Removed checks that prevented null=True ForeignKey fields from being sortable in Admin. Post queryset-refactor there seems no reason to disallow this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9080 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0ededc611f
commit
fd366a8531
|
@ -116,11 +116,7 @@ def result_headers(cl):
|
||||||
# So this _is_ a sortable non-field. Go to the yield
|
# So this _is_ a sortable non-field. Go to the yield
|
||||||
# after the else clause.
|
# after the else clause.
|
||||||
else:
|
else:
|
||||||
if isinstance(f.rel, models.ManyToOneRel) and f.null:
|
header = f.verbose_name
|
||||||
yield {"text": f.verbose_name}
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
header = f.verbose_name
|
|
||||||
|
|
||||||
th_classes = []
|
th_classes = []
|
||||||
new_order_type = 'asc'
|
new_order_type = 'asc'
|
||||||
|
|
|
@ -162,8 +162,7 @@ class ChangeList(object):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if not isinstance(f.rel, models.ManyToOneRel) or not f.null:
|
order_field = f.name
|
||||||
order_field = f.name
|
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
pass # Invalid ordering specified. Just use the default.
|
pass # Invalid ordering specified. Just use the default.
|
||||||
if ORDER_TYPE_VAR in params and params[ORDER_TYPE_VAR] in ('asc', 'desc'):
|
if ORDER_TYPE_VAR in params and params[ORDER_TYPE_VAR] in ('asc', 'desc'):
|
||||||
|
|
Loading…
Reference in New Issue