From dd0e5fd992986211bdb52b2cdfbd1e232788a20b Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Thu, 14 Aug 2008 20:51:40 +0000 Subject: [PATCH] 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 --- django/contrib/admin/templatetags/admin_list.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index c837cbe72a3d4..69b27be829b2f 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -70,8 +70,9 @@ def pagination(cl): 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: