Author: jacob
Date: 2009-10-27 15:57:13 -0500 (Tue, 27 Oct 2009)
New Revision: 11671

Modified:
   django/branches/releases/1.1.X/django/contrib/admin/media/css/changelists.css
   
django/branches/releases/1.1.X/django/contrib/admin/templatetags/admin_list.py
   django/branches/releases/1.1.X/tests/regressiontests/admin_views/tests.py
Log:
[1.1.X] Fixed #11057: having no actions in the admin (`actions=None`) no longer 
messes up the layout. Thanks, rvdrijst.

Backport of [11670] from trunk.

Modified: 
django/branches/releases/1.1.X/django/contrib/admin/media/css/changelists.css
===================================================================
--- 
django/branches/releases/1.1.X/django/contrib/admin/media/css/changelists.css   
    2009-10-27 20:56:12 UTC (rev 11670)
+++ 
django/branches/releases/1.1.X/django/contrib/admin/media/css/changelists.css   
    2009-10-27 20:57:13 UTC (rev 11671)
@@ -53,7 +53,7 @@
     vertical-align: middle;
 }
 
-#changelist table thead th:first-child {
+#changelist table thead th.action-checkbox-column {
     width: 1.5em;
     text-align: center;
 }

Modified: 
django/branches/releases/1.1.X/django/contrib/admin/templatetags/admin_list.py
===================================================================
--- 
django/branches/releases/1.1.X/django/contrib/admin/templatetags/admin_list.py  
    2009-10-27 20:56:12 UTC (rev 11670)
+++ 
django/branches/releases/1.1.X/django/contrib/admin/templatetags/admin_list.py  
    2009-10-27 20:57:13 UTC (rev 11671)
@@ -106,6 +106,11 @@
                     else:
                         header = field_name
                     header = header.replace('_', ' ')
+            # if the field is the action checkbox: no sorting and special class
+            if field_name == 'action_checkbox':
+                yield {"text": header,
+                       "class_attrib": mark_safe(' 
class="action-checkbox-column"')}
+                continue
 
             # It is a non-field, but perhaps one that is sortable
             admin_order_field = getattr(attr, "admin_order_field", None)

Modified: 
django/branches/releases/1.1.X/tests/regressiontests/admin_views/tests.py
===================================================================
--- django/branches/releases/1.1.X/tests/regressiontests/admin_views/tests.py   
2009-10-27 20:56:12 UTC (rev 11670)
+++ django/branches/releases/1.1.X/tests/regressiontests/admin_views/tests.py   
2009-10-27 20:57:13 UTC (rev 11671)
@@ -1140,7 +1140,17 @@
             '<input type="checkbox" class="action-select"' not in 
response.content,
             "Found an unexpected action toggle checkboxbox in response"
         )
+        self.assert_('action-checkbox-column' not in response.content,
+            "Found unexpected action-checkbox-column class in response")
 
+    def test_action_column_class(self):
+        "Tests that the checkbox column class is present in the response"
+        response = self.client.get('/test_admin/admin/admin_views/subscriber/')
+        self.assertNotEquals(response.context["action_form"], None)
+        self.assert_('action-checkbox-column' in response.content,
+            "Expected an action-checkbox-column in response")
+
+
     def test_multiple_actions_form(self):
         """
         Test that actions come from the form whose submit button was pressed 
(#10618).


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to