summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-08-04 03:32:56 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-08-04 03:32:56 +0000
commit808e50986b0c117541b563cec055dba2937ed453 (patch)
tree7e34d04ad7f1a86a339b38e4f5f4085e697bb0a4
parent7dc07ed937efff91c0be098c0ae6b91cd363c1dd (diff)
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
-rw-r--r--django/core/meta/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/core/meta/__init__.py b/django/core/meta/__init__.py
index 20b5ee6863..bcd8ad4b96 100644
--- a/django/core/meta/__init__.py
+++ b/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: