From 467441587c6450663d7da49b29c0457e2f61a790 Mon Sep 17 00:00:00 2001 From: Arthur Koziel Date: Wed, 11 Aug 2010 11:15:00 +0000 Subject: [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 --- django/core/apps.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'django') 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 -- cgit v1.2.1