Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #257 -- Empty model modules no longer cause an error. Thanks, B…

…ill de hÓra

git-svn-id: http://code.djangoproject.com/svn/django/trunk@397 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 808e50986b0c117541b563cec055dba2937ed453 1 parent 7dc07ed
@adrianholovaty adrianholovaty authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/core/meta/__init__.py
View
8 django/core/meta/__init__.py
@@ -100,7 +100,13 @@ def get_installed_model_modules(core_models=None):
_installed_modules_cache.append(__import__('django.models.%s' % submodule, '', '', ['']))
for m in get_installed_models():
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
class LazyDate:
Please sign in to comment.
Something went wrong with that request. Please try again.