summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-18 17:56:11 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-22 11:39:17 +0100
commitf25fa9d8590c7759c1ec7ffecf1d67be81237674 (patch)
treec0a4a40a5371ad8e0d1c1af8c04295e874170041 /django/core
parent439b364e1e81371bd87488beed35ce051be8aaaa (diff)
Deprecated load_app().
Adjusted several tests that used it to add apps to the app cache and then attempted to remove them by manipulating attributes directly. Also renamed invalid_models to invalid_models_tests to avoid clashing application labels between the outer and the inner invalid_models applications.
Diffstat (limited to 'django/core')
-rw-r--r--django/core/apps/cache.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/django/core/apps/cache.py b/django/core/apps/cache.py
index 74488325a8..65f51801ec 100644
--- a/django/core/apps/cache.py
+++ b/django/core/apps/cache.py
@@ -133,16 +133,6 @@ class AppCache(object):
self._models_loaded = True
- def load_app(self, app_name):
- """
- Loads the app with the provided fully qualified name, and returns the
- model module.
- """
- app_config = AppConfig(app_name)
- app_config.import_models(self.all_models[app_config.label])
- self.app_configs[app_config.label] = app_config
- return app_config.models_module
-
def app_cache_ready(self):
"""
Returns true if the model cache is fully populated.
@@ -377,6 +367,19 @@ class AppCache(object):
### DEPRECATED METHODS GO BELOW THIS LINE ###
+ def load_app(self, app_name):
+ """
+ Loads the app with the provided fully qualified name, and returns the
+ model module.
+ """
+ warnings.warn(
+ "load_app(app_name) is deprecated.",
+ PendingDeprecationWarning, stacklevel=2)
+ app_config = AppConfig(app_name)
+ app_config.import_models(self.all_models[app_config.label])
+ self.app_configs[app_config.label] = app_config
+ return app_config.models_module
+
def get_app(self, app_label):
"""
Returns the module containing the models for the given app_label.
@@ -447,7 +450,7 @@ class AppCache(object):
Register a set of models as belonging to an app.
"""
warnings.warn(
- "register_models(app_label, models) is deprecated.",
+ "register_models(app_label, *models) is deprecated.",
PendingDeprecationWarning, stacklevel=2)
for model in models:
self.register_model(app_label, model)