From 15f52f0c5b4226875523e881f18ad9cddbdc2a66 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Mon, 6 Mar 2006 19:32:49 +0000 Subject: [PATCH] magic-removal: Changed usage of __import__() in order to fix some obscure bugs caused by reloading of model classes. git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2489 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/loading.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/models/loading.py b/django/db/models/loading.py index 5c5b2e6c9c..fb43333f78 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -17,7 +17,7 @@ def get_apps(): _app_list = [] for app_name in settings.INSTALLED_APPS: try: - _app_list.append(__import__(app_name + '.models', '', '', [''])) + _app_list.append(__import__(app_name, '', '', ['models']).models) except ImportError, e: pass return _app_list @@ -26,7 +26,7 @@ def get_app(app_label): "Returns the module containing the models for the given app_label." for app_name in settings.INSTALLED_APPS: if app_label == app_name.split('.')[-1]: - return __import__('%s.models' % app_name, '', '', ['']) + return __import__(app_name, '', '', ['models']).models raise ImproperlyConfigured, "App with label %s could not be found" % app_label def get_models(app_mod=None):