2013-12-12 04:44:27 +08:00
|
|
|
import warnings
|
2006-05-02 09:31:56 +08:00
|
|
|
|
2013-12-24 19:25:17 +08:00
|
|
|
from django.apps import apps
|
2014-02-27 05:48:20 +08:00
|
|
|
from django.utils.deprecation import RemovedInDjango19Warning
|
|
|
|
|
2013-07-29 21:50:58 +08:00
|
|
|
|
2013-12-12 04:44:27 +08:00
|
|
|
warnings.warn(
|
|
|
|
"The utilities in django.db.models.loading are deprecated "
|
|
|
|
"in favor of the new application loading system.",
|
2014-02-27 05:48:20 +08:00
|
|
|
RemovedInDjango19Warning, stacklevel=2)
|
2008-06-22 04:55:17 +08:00
|
|
|
|
2007-08-18 01:23:15 +08:00
|
|
|
__all__ = ('get_apps', 'get_app', 'get_models', 'get_model', 'register_models',
|
2007-08-18 12:16:04 +08:00
|
|
|
'load_app', 'app_cache_ready')
|
2006-07-30 05:04:41 +08:00
|
|
|
|
2014-03-02 21:01:52 +08:00
|
|
|
# Backwards-compatibility for private APIs during the deprecation period.
|
|
|
|
UnavailableApp = LookupError
|
|
|
|
cache = apps
|
|
|
|
|
2007-08-18 01:23:15 +08:00
|
|
|
# These methods were always module level, so are kept that way for backwards
|
2013-05-09 22:16:43 +08:00
|
|
|
# compatibility.
|
2013-12-24 19:25:17 +08:00
|
|
|
get_apps = apps.get_apps
|
|
|
|
get_app_package = apps.get_app_package
|
|
|
|
get_app_path = apps.get_app_path
|
|
|
|
get_app_paths = apps.get_app_paths
|
|
|
|
get_app = apps.get_app
|
|
|
|
get_models = apps.get_models
|
|
|
|
get_model = apps.get_model
|
|
|
|
register_models = apps.register_models
|
|
|
|
load_app = apps.load_app
|
2013-12-31 21:07:40 +08:00
|
|
|
app_cache_ready = apps.app_cache_ready
|
2013-12-12 18:36:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
# This method doesn't return anything interesting in Django 1.6. Maintain it
|
|
|
|
# just for backwards compatibility until this module is deprecated.
|
|
|
|
def get_app_errors():
|
|
|
|
try:
|
2013-12-24 19:25:17 +08:00
|
|
|
return apps.app_errors
|
2013-12-12 18:36:40 +08:00
|
|
|
except AttributeError:
|
2013-12-24 19:25:17 +08:00
|
|
|
apps.app_errors = {}
|
|
|
|
return apps.app_errors
|