mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #15185 -- Allowed ModelAdmin.list_display_links=None to disable change list links.
Thanks rm_ for the suggestion.
This commit is contained in:
committed by
Tim Graham
parent
bf757a2f4d
commit
1d0fc61b1c
@@ -19,7 +19,7 @@ from .admin import (ChildAdmin, QuartetAdmin, BandAdmin, ChordsBandAdmin,
|
||||
DynamicListDisplayLinksChildAdmin, CustomPaginationAdmin,
|
||||
FilteredChildAdmin, CustomPaginator, site as custom_site,
|
||||
SwallowAdmin, DynamicListFilterChildAdmin, InvitationAdmin,
|
||||
DynamicSearchFieldsChildAdmin)
|
||||
DynamicSearchFieldsChildAdmin, NoListDisplayLinksParentAdmin)
|
||||
from .models import (Event, Child, Parent, Genre, Band, Musician, Group,
|
||||
Quartet, Membership, ChordsMusician, ChordsBand, Invitation, Swallow,
|
||||
UnorderedObject, OrderedObject, CustomIdUser)
|
||||
@@ -460,6 +460,16 @@ class ChangeListTests(TestCase):
|
||||
self.assertEqual(list_display, ('parent', 'name', 'age'))
|
||||
self.assertEqual(list_display_links, ['age'])
|
||||
|
||||
def test_no_list_display_links(self):
|
||||
"""#15185 -- Allow no links from the 'change list' view grid."""
|
||||
p = Parent.objects.create(name='parent')
|
||||
m = NoListDisplayLinksParentAdmin(Parent, admin.site)
|
||||
superuser = self._create_superuser('superuser')
|
||||
request = self._mocked_authenticated_request('/parent/', superuser)
|
||||
response = m.changelist_view(request)
|
||||
link = reverse('admin:admin_changelist_parent_change', args=(p.pk,))
|
||||
self.assertNotContains(response, '<a href="%s">' % link)
|
||||
|
||||
def test_tuple_list_display(self):
|
||||
"""
|
||||
Regression test for #17128
|
||||
|
||||
Reference in New Issue
Block a user