Fixed #8324 -- Corrected the simple case where list_display is not given. Thanks tobias for the quick report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8353 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner 2008-08-14 20:51:40 +00:00
parent b2ec6473c0
commit dd0e5fd992
1 changed files with 4 additions and 2 deletions

View File

@ -70,8 +70,9 @@ pagination = register.inclusion_tag('admin/pagination.html')(pagination)
def result_headers(cl):
lookup_opts = cl.lookup_opts
for i, field_name in enumerate(cl.list_display):
attr = None
try:
f = lookup_opts.get_field(field_name)
admin_order_field = None
@ -150,7 +151,8 @@ def items_for_result(cl, result):
if callable(field_name):
attr = field_name
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)
value = attr(result)
else: