1
0
mirror of https://github.com/django/django.git synced 2025-10-28 16:16:12 +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:
Mariusz Felisiak
2023-07-07 08:06:01 +02:00
committed by GitHub
parent d569c1dcfe
commit f64fd47a76
15 changed files with 127 additions and 69 deletions

View File

@@ -276,8 +276,7 @@ class SystemChecksTestCase(SimpleTestCase):
class MyBookAdmin(admin.ModelAdmin):
def check(self, **kwargs):
errors = super().check(**kwargs)
author_admin = self.admin_site._registry.get(Author)
if author_admin is None:
if not self.admin_site.is_registered(Author):
errors.append("AuthorAdmin missing!")
return errors