Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #11057: having no actions in the admin (`actions=None`) no long…

…er messes up the layout. Thanks, rvdrijst.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11670 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4281bf3db058ed9ed860dd2f33a3de22d34dfa5f 1 parent d0b900e
Jacob Kaplan-Moss authored October 27, 2009
2  django/contrib/admin/media/css/changelists.css
@@ -53,7 +53,7 @@
53 53
     vertical-align: middle;
54 54
 }
55 55
 
56  
-#changelist table thead th:first-child {
  56
+#changelist table thead th.action-checkbox-column {
57 57
     width: 1.5em;
58 58
     text-align: center;
59 59
 }
5  django/contrib/admin/templatetags/admin_list.py
@@ -106,6 +106,11 @@ def result_headers(cl):
106 106
                     else:
107 107
                         header = field_name
108 108
                     header = header.replace('_', ' ')
  109
+            # if the field is the action checkbox: no sorting and special class
  110
+            if field_name == 'action_checkbox':
  111
+                yield {"text": header,
  112
+                       "class_attrib": mark_safe(' class="action-checkbox-column"')}
  113
+                continue
109 114
 
110 115
             # It is a non-field, but perhaps one that is sortable
111 116
             admin_order_field = getattr(attr, "admin_order_field", None)
10  tests/regressiontests/admin_views/tests.py
@@ -1141,6 +1141,16 @@ def test_model_without_action(self):
1141 1141
             '<input type="checkbox" class="action-select"' not in response.content,
1142 1142
             "Found an unexpected action toggle checkboxbox in response"
1143 1143
         )
  1144
+        self.assert_('action-checkbox-column' not in response.content,
  1145
+            "Found unexpected action-checkbox-column class in response")
  1146
+
  1147
+    def test_action_column_class(self):
  1148
+        "Tests that the checkbox column class is present in the response"
  1149
+        response = self.client.get('/test_admin/admin/admin_views/subscriber/')
  1150
+        self.assertNotEquals(response.context["action_form"], None)
  1151
+        self.assert_('action-checkbox-column' in response.content,
  1152
+            "Expected an action-checkbox-column in response")
  1153
+
1144 1154
 
1145 1155
     def test_multiple_actions_form(self):
1146 1156
         """

0 notes on commit 4281bf3

Please sign in to comment.
Something went wrong with that request. Please try again.