Skip to content

Commit

Permalink
Fixed #8324 -- Corrected the simple case where list_display is not gi…
Browse files Browse the repository at this point in the history
…ven. Thanks tobias for the quick report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8353 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
brosner committed Aug 14, 2008
1 parent b2ec647 commit dd0e5fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions django/contrib/admin/templatetags/admin_list.py
Expand Up @@ -70,8 +70,9 @@ def pagination(cl):


def result_headers(cl): def result_headers(cl):
lookup_opts = cl.lookup_opts lookup_opts = cl.lookup_opts

for i, field_name in enumerate(cl.list_display): for i, field_name in enumerate(cl.list_display):
attr = None
try: try:
f = lookup_opts.get_field(field_name) f = lookup_opts.get_field(field_name)
admin_order_field = None admin_order_field = None
Expand Down Expand Up @@ -150,7 +151,8 @@ def items_for_result(cl, result):
if callable(field_name): if callable(field_name):
attr = field_name attr = field_name
value = attr(result) value = attr(result)
elif hasattr(cl.model_admin, field_name): elif hasattr(cl.model_admin, field_name) and \
not field_name == '__str__' and not field_name == '__unicode__':
attr = getattr(cl.model_admin, field_name) attr = getattr(cl.model_admin, field_name)
value = attr(result) value = attr(result)
else: else:
Expand Down

0 comments on commit dd0e5fd

Please sign in to comment.