diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 6be2a64..98e80e3 100644
a
|
b
|
class ModelAdmin(BaseModelAdmin):
|
342 | 342 | self.model = model |
343 | 343 | self.opts = model._meta |
344 | 344 | self.admin_site = admin_site |
345 | | if 'action_checkbox' not in self.list_display and self.actions is not None: |
346 | | self.list_display = ['action_checkbox'] + list(self.list_display) |
347 | | if not self.list_display_links: |
348 | | for name in self.list_display: |
349 | | if name != 'action_checkbox': |
350 | | self.list_display_links = [name] |
351 | | break |
352 | 345 | super(ModelAdmin, self).__init__() |
353 | 346 | |
354 | 347 | def get_inline_instances(self, request): |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
1105 | 1098 | actions = self.get_actions(request) |
1106 | 1099 | |
1107 | 1100 | # Remove action checkboxes if there aren't any actions available. |
1108 | | list_display = list(self.get_list_display(request)) |
1109 | | if not actions: |
1110 | | try: |
1111 | | list_display.remove('action_checkbox') |
1112 | | except ValueError: |
1113 | | pass |
| 1101 | list_display = self.get_list_display(request) |
| 1102 | |
| 1103 | list_display_links = self.list_display_links |
| 1104 | if not self.list_display_links and list_display: |
| 1105 | list_display_links = list(list_display)[:1] |
| 1106 | |
| 1107 | if actions: |
| 1108 | list_display = ['action_checkbox'] + list(list_display) |
1114 | 1109 | |
1115 | 1110 | ChangeList = self.get_changelist(request) |
1116 | 1111 | try: |
1117 | | cl = ChangeList(request, self.model, list_display, self.list_display_links, |
1118 | | self.list_filter, self.date_hierarchy, self.search_fields, |
1119 | | self.list_select_related, self.list_per_page, self.list_max_show_all, self.list_editable, self) |
| 1112 | cl = ChangeList(request, self.model, list_display, |
| 1113 | list_display_links, self.list_filter, self.date_hierarchy, |
| 1114 | self.search_fields, self.list_select_related, |
| 1115 | self.list_per_page, self.list_max_show_all, self.list_editable, |
| 1116 | self) |
1120 | 1117 | except IncorrectLookupParameters: |
1121 | 1118 | # Wacky lookup parameters were given, so redirect to the main |
1122 | 1119 | # changelist page, without parameters, and pass an 'invalid=1' |
diff --git a/tests/regressiontests/admin_changelist/tests.py b/tests/regressiontests/admin_changelist/tests.py
index 5f2ebff..a081c98 100644
a
|
b
|
class ChangeListTests(TestCase):
|
48 | 48 | template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}') |
49 | 49 | context = Context({'cl': cl}) |
50 | 50 | table_output = template.render(context) |
51 | | row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="%d" name="_selected_action" /></td><th><a href="%d/">name</a></th><td class="nowrap">(None)</td></tr></tbody>' % (new_child.id, new_child.id) |
| 51 | row_html = '<tbody><tr class="row1"><th><a href="%d/">name</a></th><td class="nowrap">(None)</td></tr></tbody>' % new_child.id |
52 | 52 | self.assertFalse(table_output.find(row_html) == -1, |
53 | 53 | 'Failed to find expected row element: %s' % table_output) |
54 | 54 | |
… |
… |
class ChangeListTests(TestCase):
|
68 | 68 | template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}') |
69 | 69 | context = Context({'cl': cl}) |
70 | 70 | table_output = template.render(context) |
71 | | row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="%d" name="_selected_action" /></td><th><a href="%d/">name</a></th><td class="nowrap">Parent object</td></tr></tbody>' % (new_child.id, new_child.id) |
| 71 | row_html = '<tbody><tr class="row1"><th><a href="%d/">name</a></th><td class="nowrap">Parent object</td></tr></tbody>' % new_child.id |
72 | 72 | self.assertFalse(table_output.find(row_html) == -1, |
73 | 73 | 'Failed to find expected row element: %s' % table_output) |
74 | 74 | |
diff --git a/tests/regressiontests/admin_registration/tests.py b/tests/regressiontests/admin_registration/tests.py
index 1ba8bb1..1b2d291 100644
a
|
b
|
class TestRegistration(TestCase):
|
42 | 42 | search_fields=["name"], list_display=['__str__']) |
43 | 43 | self.assertEqual(self.site._registry[Person].search_fields, ['name']) |
44 | 44 | self.assertEqual(self.site._registry[Person].list_display, |
45 | | ['action_checkbox', '__str__']) |
| 45 | ['__str__']) |
46 | 46 | self.assertTrue(self.site._registry[Person].save_on_top) |
47 | 47 | |
48 | 48 | def test_iterable_registration(self): |