sideabr fixes 7 atemepts in it
This commit is contained in:
@@ -28,6 +28,23 @@ class Igny8AdminConfig(AdminConfig):
|
||||
|
||||
def ready(self):
|
||||
super().ready()
|
||||
|
||||
# Replace default admin.site with our custom Igny8AdminSite
|
||||
# IMPORTANT: Must copy all registrations from old site to new site
|
||||
# because models register themselves before ready() is called
|
||||
from igny8_core.admin.site import admin_site
|
||||
import django.contrib.admin as admin_module
|
||||
|
||||
# Copy all model registrations from the default site to our custom site
|
||||
old_site = admin_module.site
|
||||
admin_site._registry = old_site._registry.copy()
|
||||
admin_site._actions = old_site._actions.copy()
|
||||
admin_site._global_actions = old_site._global_actions.copy()
|
||||
|
||||
# Now replace the default site
|
||||
admin_module.site = admin_site
|
||||
admin_module.sites.site = admin_site
|
||||
|
||||
# Import Unfold AFTER apps are ready
|
||||
from unfold.admin import ModelAdmin as UnfoldModelAdmin
|
||||
|
||||
|
||||
Reference in New Issue
Block a user