From 808e50986b0c117541b563cec055dba2937ed453 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 4 Aug 2005 03:32:56 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20#257=20--=20Empty=20model=20modules=20n?= =?UTF-8?q?o=20longer=20cause=20an=20error.=20Thanks,=20Bill=20de=20h?= =?UTF-8?q?=C3=93ra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@397 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/meta/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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: