loading.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import warnings
  2. from django.apps import apps
  3. from django.utils.deprecation import RemovedInDjango19Warning
  4. warnings.warn(
  5. "The utilities in django.db.models.loading are deprecated "
  6. "in favor of the new application loading system.",
  7. RemovedInDjango19Warning, stacklevel=2)
  8. __all__ = ('get_apps', 'get_app', 'get_models', 'get_model', 'register_models',
  9. 'load_app', 'app_cache_ready')
  10. # Backwards-compatibility for private APIs during the deprecation period.
  11. UnavailableApp = LookupError
  12. cache = apps
  13. # These methods were always module level, so are kept that way for backwards
  14. # compatibility.
  15. get_apps = apps.get_apps
  16. get_app_package = apps.get_app_package
  17. get_app_path = apps.get_app_path
  18. get_app_paths = apps.get_app_paths
  19. get_app = apps.get_app
  20. get_models = apps.get_models
  21. get_model = apps.get_model
  22. register_models = apps.register_models
  23. load_app = apps.load_app
  24. app_cache_ready = apps.app_cache_ready
  25. # This method doesn't return anything interesting in Django 1.6. Maintain it
  26. # just for backwards compatibility until this module is deprecated.
  27. def get_app_errors():
  28. try:
  29. return apps.app_errors
  30. except AttributeError:
  31. apps.app_errors = {}
  32. return apps.app_errors