Author: adrian
Date: 2006-07-11 14:08:24 -0500 (Tue, 11 Jul 2006)
New Revision: 3333

Modified:
   django/trunk/django/contrib/admin/templatetags/admin_list.py
Log:
Fixed #2301 -- Fixed HTML problem with list_display_links. Thanks, kilian

Modified: django/trunk/django/contrib/admin/templatetags/admin_list.py
===================================================================
--- django/trunk/django/contrib/admin/templatetags/admin_list.py        
2006-07-11 14:46:42 UTC (rev 3332)
+++ django/trunk/django/contrib/admin/templatetags/admin_list.py        
2006-07-11 19:08:24 UTC (rev 3333)
@@ -167,11 +167,12 @@
             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))
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---

Reply via email to