Skip to content

Commit 0a382bd

Browse files
authored
Merge pull request #417 from jnoortheen/master
refactor: use django.apps instead of INSTALLED_APPS setting
2 parents 151d1c1 + 13ee4f0 commit 0a382bd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

xadmin/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def autodiscover():
1717
from importlib import import_module
1818
from django.conf import settings
1919
from django.utils.module_loading import module_has_submodule
20+
from django.apps import apps
21+
2022
setattr(settings, 'CRISPY_TEMPLATE_PACK', 'bootstrap3')
2123
setattr(settings, 'CRISPY_CLASS_CONVERTERS', {
2224
"textinput": "textinput textInput form-control",
@@ -46,12 +48,12 @@ def autodiscover():
4648
from xadmin.plugins import register_builtin_plugins
4749
register_builtin_plugins(site)
4850

49-
for app in settings.INSTALLED_APPS:
50-
mod = import_module(app)
51+
for app_config in apps.get_app_configs():
52+
mod = import_module(app_config.name)
5153
# Attempt to import the app's admin module.
5254
try:
5355
before_import_registry = site.copy_registry()
54-
import_module('%s.adminx' % app)
56+
import_module('%s.adminx' % app_config.name)
5557
except:
5658
# Reset the model registry to the state before the last import as
5759
# this import will have to reoccur on the next request and this

0 commit comments

Comments
 (0)