diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-14 11:11:52 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-17 10:17:45 +0100 |
| commit | 69039becde74308d6218c72c1e410cd0049fd2bd (patch) | |
| tree | 4c7c669ad326fb376ecda6bf8532d3000a293518 /django/apps/cache.py | |
| parent | 2732edc5f2305cf454d5df43c7d85a68c639493e (diff) | |
Deprecated get_app().
Diffstat (limited to 'django/apps/cache.py')
| -rw-r--r-- | django/apps/cache.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/django/apps/cache.py b/django/apps/cache.py index c0648a9015..76e580eb40 100644 --- a/django/apps/cache.py +++ b/django/apps/cache.py @@ -189,19 +189,6 @@ class BaseAppCache(object): raise UnavailableApp("App with label %r isn't available." % app_label) return app_config - def get_app(self, app_label): - """ - Returns the module containing the models for the given app_label. - - Raises UnavailableApp when set_available_apps() in in effect and - doesn't include app_label. - """ - try: - return self.get_app_config(app_label).models_module - except LookupError as exc: - # Change the exception type for backwards compatibility. - raise ImproperlyConfigured(*exc.args) - def get_models(self, app_mod=None, include_auto_created=False, include_deferred=False, only_installed=True, include_swapped=False): @@ -332,6 +319,22 @@ class BaseAppCache(object): ### DEPRECATED METHODS GO BELOW THIS LINE ### + def get_app(self, app_label): + """ + Returns the module containing the models for the given app_label. + + Raises UnavailableApp when set_available_apps() in in effect and + doesn't include app_label. + """ + warnings.warn( + "get_app_config(app_label).models_module supersedes get_app(app_label).", + PendingDeprecationWarning, stacklevel=2) + try: + return self.get_app_config(app_label).models_module + except LookupError as exc: + # Change the exception type for backwards compatibility. + raise ImproperlyConfigured(*exc.args) + def get_apps(self): """ Returns a list of all installed modules that contain models. |
