Fixed #257 -- Empty model modules no longer cause an error. Thanks, Bill de hÓra
git-svn-id: http://code.djangoproject.com/svn/django/trunk@397 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7dc07ed937
commit
808e50986b
|
@ -100,7 +100,13 @@ def get_installed_model_modules(core_models=None):
|
||||||
_installed_modules_cache.append(__import__('django.models.%s' % submodule, '', '', ['']))
|
_installed_modules_cache.append(__import__('django.models.%s' % submodule, '', '', ['']))
|
||||||
for m in get_installed_models():
|
for m in get_installed_models():
|
||||||
for submodule in getattr(m, '__all__', []):
|
for submodule in getattr(m, '__all__', []):
|
||||||
_installed_modules_cache.append(__import__('django.models.%s' % submodule, '', '', ['']))
|
mod = __import__('django.models.%s' % submodule, '', '', [''])
|
||||||
|
try:
|
||||||
|
mod._MODELS
|
||||||
|
except AttributeError:
|
||||||
|
pass # Skip model modules that don't actually have models in them.
|
||||||
|
else:
|
||||||
|
_installed_modules_cache.append(mod)
|
||||||
return _installed_modules_cache
|
return _installed_modules_cache
|
||||||
|
|
||||||
class LazyDate:
|
class LazyDate:
|
||||||
|
|
Loading…
Reference in New Issue