diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-07-11 19:08:24 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-07-11 19:08:24 +0000 |
| commit | 085b74406f4fb57368fdbdbc4e78b94e90186dba (patch) | |
| tree | f054286fd1bfba2fd5f23bde6d4440be1aced944 | |
| parent | 78adbd9434df03a28acc929f0b00f253dd634833 (diff) | |
Fixed #2301 -- Fixed HTML problem with list_display_links. Thanks, kilian
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3333 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/admin/templatetags/admin_list.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 3537f46755..ca250ba433 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -167,11 +167,12 @@ def items_for_result(cl, result): result_repr = ' ' # If list_display_links not defined, add the link tag to the first field if (first and not cl.lookup_opts.admin.list_display_links) or field_name in cl.lookup_opts.admin.list_display_links: + table_tag = {True:'th', False:'td'}[first] first = False url = cl.url_for_result(result) result_id = str(getattr(result, pk)) # str() is needed in case of 23L (long ints) - yield ('<th%s><a href="%s"%s>%s</a></th>' % \ - (row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %r); return false;"' % result_id or ''), result_repr)) + yield ('<%s%s><a href="%s"%s>%s</a></%s>' % \ + (table_tag, row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %r); return false;"' % result_id or ''), result_repr, table_tag)) else: yield ('<td%s>%s</td>' % (row_class, result_repr)) |
