Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #2301 -- Fixed HTML problem with list_display_links. Thanks, ki…

…lian

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3333 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 085b74406f4fb57368fdbdbc4e78b94e90186dba 1 parent 78adbd9
Adrian Holovaty adrianholovaty authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/contrib/admin/templatetags/admin_list.py
5 django/contrib/admin/templatetags/admin_list.py
View
@@ -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))
Please sign in to comment.
Something went wrong with that request. Please try again.