Skip to content

Commit

Permalink
refactor: use django.apps instead of INSTALLED_APPS setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jnoortheen committed Jul 3, 2017
1 parent 151d1c1 commit 13ee4f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions xadmin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def autodiscover():
from importlib import import_module
from django.conf import settings
from django.utils.module_loading import module_has_submodule
from django.apps import apps

setattr(settings, 'CRISPY_TEMPLATE_PACK', 'bootstrap3')
setattr(settings, 'CRISPY_CLASS_CONVERTERS', {
"textinput": "textinput textInput form-control",
Expand Down Expand Up @@ -46,12 +48,12 @@ def autodiscover():
from xadmin.plugins import register_builtin_plugins
register_builtin_plugins(site)

for app in settings.INSTALLED_APPS:
mod = import_module(app)
for app_config in apps.get_app_configs():
mod = import_module(app_config.name)
# Attempt to import the app's admin module.
try:
before_import_registry = site.copy_registry()
import_module('%s.adminx' % app)
import_module('%s.adminx' % app_config.name)
except:
# Reset the model registry to the state before the last import as
# this import will have to reoccur on the next request and this
Expand Down

0 comments on commit 13ee4f0

Please sign in to comment.