mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-16 21:30:23 +00:00
Merge pull request #412 from vstoykov/feature/appconfigs-module-loading
Replaces #301 autodiscover works with AppConfig
This commit is contained in:
commit
16ab0d2c99
1 changed files with 24 additions and 0 deletions
|
|
@ -69,6 +69,30 @@ def autodiscover():
|
|||
"""
|
||||
global _autodiscovered
|
||||
|
||||
if _autodiscovered:
|
||||
return
|
||||
|
||||
try:
|
||||
from django.utils.module_loading import autodiscover_modules
|
||||
except ImportError:
|
||||
# Django<1.7
|
||||
_autodiscover_modules_fallback()
|
||||
else:
|
||||
autodiscover_modules('imagegenerators')
|
||||
|
||||
|
||||
def _autodiscover_modules_fallback():
|
||||
"""
|
||||
Auto-discover INSTALLED_APPS imagegenerators.py modules and fail silently
|
||||
when not present. This forces an import on them to register any admin bits
|
||||
they may want.
|
||||
|
||||
Copied from django.contrib.admin
|
||||
|
||||
Used for Django versions < 1.7
|
||||
"""
|
||||
global _autodiscovered
|
||||
|
||||
if _autodiscovered:
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue