mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-16 21:30:23 +00:00
Added global boolean to prevent autodiscover() from being called more than once.
This commit is contained in:
parent
bc8fdd7ada
commit
d647678c2e
1 changed files with 7 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ from .lib import NullHandler
|
|||
|
||||
bad_memcached_key_chars = re.compile(ur'[\u0000-\u001f\s]+')
|
||||
|
||||
_autodiscovered = False
|
||||
|
||||
def get_nonabstract_descendants(model):
|
||||
""" Returns all non-abstract descendants of the model. """
|
||||
|
|
@ -62,11 +63,17 @@ def autodiscover():
|
|||
|
||||
Copied from django.contrib.admin
|
||||
"""
|
||||
global _autodiscovered
|
||||
|
||||
if _autodiscovered:
|
||||
return
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.importlib import import_module
|
||||
from django.utils.module_loading import module_has_submodule
|
||||
|
||||
_autodiscovered = True
|
||||
|
||||
for app in settings.INSTALLED_APPS:
|
||||
mod = import_module(app)
|
||||
# Attempt to import the app's admin module.
|
||||
|
|
|
|||
Loading…
Reference in a new issue