Skip to content

Commit

Permalink
Fixed #7582: Removed checks that prevented null=True ForeignKey field…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
kmtracey committed Sep 21, 2008
1 parent 0ededc6 commit fd366a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions django/contrib/admin/templatetags/admin_list.py
Expand Up @@ -116,11 +116,7 @@ def result_headers(cl):
# So this _is_ a sortable non-field. Go to the yield
# after the else clause.
else:
if isinstance(f.rel, models.ManyToOneRel) and f.null:
yield {"text": f.verbose_name}
continue
else:
header = f.verbose_name
header = f.verbose_name

th_classes = []
new_order_type = 'asc'
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/admin/views/main.py
Expand Up @@ -162,8 +162,7 @@ def get_ordering(self):
except AttributeError:
pass
else:
if not isinstance(f.rel, models.ManyToOneRel) or not f.null:
order_field = f.name
order_field = f.name
except (IndexError, ValueError):
pass # Invalid ordering specified. Just use the default.
if ORDER_TYPE_VAR in params and params[ORDER_TYPE_VAR] in ('asc', 'desc'):
Expand Down

0 comments on commit fd366a8

Please sign in to comment.