Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Commit b45f4e8

Browse files
committed
fix: override default admin site by replacing underlying AdminSite
class Note that DefaultAdminSite is a LazyObject so this seems like a correct way to do it
1 parent bdc5905 commit b45f4e8

File tree

1 file changed

+1
-9
lines changed
  • django_admin_keyboard_shortcuts

1 file changed

+1
-9
lines changed

django_admin_keyboard_shortcuts/apps.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,4 @@ class AdminKeyboardShortcutsConfig(AppConfig):
1111

1212
def ready(self):
1313
# Monkey patch the admin.site with our KSAdminSite
14-
# Make sure ModelAdmin instances being registered to admin.site
15-
# are registered with our KSAdminSite instead of the default one.
16-
ks_admin_site = KSAdminSite()
17-
18-
def ks_admin_register(model, admin_class=None, **options):
19-
ks_admin_site.register(model, admin_class, **options)
20-
21-
admin.site.register = ks_admin_register
22-
admin.site = ks_admin_site
14+
admin.site._wrapped = KSAdminSite()

0 commit comments

Comments
 (0)