Code

Ticket #13599: hide_td_containing_hidden_input_in_changelist.diff

File hide_td_containing_hidden_input_in_changelist.diff, 829 bytes (added by skevy, 4 years ago)

Hide's the td containing a hidden input in the changelist.

Line 
1Index: django/contrib/admin/templatetags/admin_list.py
2===================================================================
3--- django/contrib/admin/templatetags/admin_list.py     (revision 13301)
4+++ django/contrib/admin/templatetags/admin_list.py     (working copy)
5@@ -190,7 +190,10 @@
6                 result_repr = conditional_escape(result_repr)
7             yield mark_safe(u'<td%s>%s</td>' % (row_class, result_repr))
8     if form:
9-        yield mark_safe(u'<td>%s</td>' % force_unicode(form[cl.model._meta.pk.name]))
10+        if form[cl.model._meta.pk.name].is_hidden:
11+            yield mark_safe(u'<td style="display:none;">%s</td>' % force_unicode(form[cl.model._meta.pk.name]))
12+        else:
13+            yield mark_safe(u'<td>%s</td>' % force_unicode(form[cl.model._meta.pk.name]))
14 
15 def results(cl):
16     if cl.formset: