mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #9602 -- Added AdminSite.get_model_admin().
This allows retrieving an admin class for the given model class without using internal attributes.
This commit is contained in:
@@ -878,7 +878,7 @@ class ChangeListTests(TestCase):
|
||||
user_parents = self._create_superuser("parents")
|
||||
|
||||
# Test with user 'noparents'
|
||||
m = custom_site._registry[Child]
|
||||
m = custom_site.get_model_admin(Child)
|
||||
request = self._mocked_authenticated_request("/child/", user_noparents)
|
||||
response = m.changelist_view(request)
|
||||
self.assertNotContains(response, "Parent object")
|
||||
@@ -903,7 +903,7 @@ class ChangeListTests(TestCase):
|
||||
|
||||
# Test default implementation
|
||||
custom_site.register(Child, ChildAdmin)
|
||||
m = custom_site._registry[Child]
|
||||
m = custom_site.get_model_admin(Child)
|
||||
request = self._mocked_authenticated_request("/child/", user_noparents)
|
||||
response = m.changelist_view(request)
|
||||
self.assertContains(response, "Parent object")
|
||||
|
||||
Reference in New Issue
Block a user