diff options
author | Arthur Koziel <arthur@arthurkoziel.com> | 2010-08-11 11:15:00 +0000 |
---|---|---|
committer | Arthur Koziel <arthur@arthurkoziel.com> | 2010-08-11 11:15:00 +0000 |
commit | 467441587c6450663d7da49b29c0457e2f61a790 (patch) | |
tree | 46a2ac751c2b943ee15d9714f631318b30af4798 /django | |
parent | 2b7bfaccf2d9b9f19595e8024620ee988d1305e7 (diff) | |
download | django-467441587c6450663d7da49b29c0457e2f61a790.tar.gz |
[soc2010/app-loading] raise ImproperlyConfigured when trying to register models to an app that isnt listed in INSTALLED_APPS
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/app-loading@13571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r-- | django/core/apps.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/django/core/apps.py b/django/core/apps.py index 9535e08822..5f37d8d879 100644 --- a/django/core/apps.py +++ b/django/core/apps.py @@ -173,12 +173,8 @@ class AppCache(object): def get_apps(self): "Returns a list of all installed modules that contain models." self._populate() - - # Ensure the returned list is always in the same order (with new apps - # added at the end). This avoids unstable ordering on the admin app - # list page, for example. return [app.models_module for app in self.app_instances\ - if app.models_module] + if hasattr(app, 'models_module')] def get_app(self, app_label, emptyOK=False): """ @@ -266,13 +262,10 @@ class AppCache(object): Register a set of models as belonging to an app. """ app_instance = self.find_app(app_label) - - # Create a new App instance if the ModelBase tries to register - # an app that isn't listed in INSTALLED_APPS if not app_instance: - app_instance = App(app_label) - self.app_instances.append(app_instance) - + raise ImproperlyConfigured('Could not find App instance with label "%s". ' + 'Please check your INSTALLED_APPS setting' + % app_label) for model in models: # Store as 'name: model' pair in a dictionary # in the models list of the App instance |