Skip to content

Commit

Permalink
Fixed #15291 -- Corrected alignment issue when actions are disabled i…
Browse files Browse the repository at this point in the history
…n a ModelAdmin. Thanks to Julien Phalip for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Feb 19, 2011
1 parent d3cc5db commit b3c7e39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion django/contrib/admin/media/css/changelists.css
Expand Up @@ -67,7 +67,10 @@
#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 {
Expand Down
2 changes: 2 additions & 0 deletions django/contrib/admin/templatetags/admin_list.py
Expand Up @@ -139,6 +139,8 @@ def items_for_result(cl, result, form):
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:
Expand Down
4 changes: 2 additions & 2 deletions tests/regressiontests/admin_changelist/tests.py
Expand Up @@ -36,7 +36,7 @@ def test_result_list_empty_changelist_value(self):
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)

Expand All @@ -57,7 +57,7 @@ def test_result_list_html(self):
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)

Expand Down

0 comments on commit b3c7e39

Please sign in to comment.