summaryrefslogtreecommitdiff
path: root/django/core/serializers/python.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-11 23:31:34 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-17 10:17:44 +0100
commit8662654d6d50e4d89f771a757ae5fc83c6b74db0 (patch)
tree1b9d98842d25a5d15a389bcc0dcefdc4fcffef4f /django/core/serializers/python.py
parent334551339de38569ac3530886e3f9cc681190224 (diff)
downloaddjango-8662654d6d50e4d89f771a757ae5fc83c6b74db0.tar.gz
Removed module-level functions for the app cache.
Since the original ones in django.db.models.loading were kept only for backwards compatibility, there's no need to recreate them. However, many internals of Django still relied on them. They were also imported in django.db.models. They never appear in the documentation, except a quick mention of get_models and get_app in the 1.2 release notes to document an edge case in GIS. I don't think that makes them a public API. This commit doesn't change the overall amount of global state but clarifies that it's tied to the app_cache object instead of hiding it behind half a dozen functions.
Diffstat (limited to 'django/core/serializers/python.py')
-rw-r--r--django/core/serializers/python.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/core/serializers/python.py b/django/core/serializers/python.py
index 4ac7cc4cf1..07f857a198 100644
--- a/django/core/serializers/python.py
+++ b/django/core/serializers/python.py
@@ -5,6 +5,7 @@ other serializers.
"""
from __future__ import unicode_literals
+from django.apps import app_cache
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
@@ -87,7 +88,7 @@ def Deserializer(object_list, **options):
db = options.pop('using', DEFAULT_DB_ALIAS)
ignore = options.pop('ignorenonexistent', False)
- models.get_apps()
+ app_cache.get_apps()
for d in object_list:
# Look up the model and starting build a dict of data for it.
Model = _get_model(d["model"])
@@ -153,7 +154,7 @@ def _get_model(model_identifier):
Helper to look up a model from an "app_label.model_name" string.
"""
try:
- Model = models.get_model(*model_identifier.split("."))
+ Model = app_cache.get_model(*model_identifier.split("."))
except TypeError:
Model = None
if Model is None: