Commits

Anonymous committed 97f3b74

[1.2.X] Fixed #15291 -- Corrected alignment issue when actions are disabled in a ModelAdmin. Thanks to Julien Phalip for the report and patch.

Backport of r15573 from trunk.

Comments (0)

Files changed (3)

django/contrib/admin/media/css/changelists.css

 #changelist table tbody td:first-child, #changelist table tbody th:first-child {
     border-left: 0;
     border-right: 1px solid #ddd;
-    text-align: center;
+}
+
+#changelist table tbody td.action-checkbox {
+    text-align:center;
 }
 
 #changelist table tfoot {

django/contrib/admin/templatetags/admin_list.py

             result_repr = EMPTY_CHANGELIST_VALUE
         else:
             if f is None:
+                if field_name == u'action_checkbox':
+                    row_class = ' class="action-checkbox"'
                 allow_tags = getattr(attr, 'allow_tags', False)
                 boolean = getattr(attr, 'boolean', False)
                 if boolean:

tests/regressiontests/admin_changelist/tests.py

         template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}')
         context = Context({'cl': cl})
         table_output = template.render(context)
-        row_html = '<tbody><tr class="row1"><td><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td>(None)</td></tr></tbody>'
+        row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td>(None)</td></tr></tbody>'
         self.assertFalse(table_output.find(row_html) == -1,
             'Failed to find expected row element: %s' % table_output)
 
         template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}')
         context = Context({'cl': cl})
         table_output = template.render(context)
-        row_html = '<tbody><tr class="row1"><td><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td>Parent object</td></tr></tbody>'
+        row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td>Parent object</td></tr></tbody>'
         self.assertFalse(table_output.find(row_html) == -1,
             'Failed to find expected row element: %s' % table_output)