mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Stopped populating the app registry as a side effect.
Since it triggers imports, it shouldn't be done lightly. This commit adds a public API for doing it explicitly, django.setup(), and does it automatically when using manage.py and wsgi.py.
This commit is contained in:
@@ -3,7 +3,6 @@ Module for abstract serializer/unserializer base classes.
|
||||
"""
|
||||
import warnings
|
||||
|
||||
from django.apps import apps
|
||||
from django.db import models
|
||||
from django.utils import six
|
||||
|
||||
@@ -137,9 +136,6 @@ class Deserializer(six.Iterator):
|
||||
self.stream = six.StringIO(stream_or_string)
|
||||
else:
|
||||
self.stream = stream_or_string
|
||||
# Make sure the app registy is loaded before deserialization starts
|
||||
# (otherwise subclass calls to get_model() and friends might fail...)
|
||||
apps.populate_models()
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
@@ -88,8 +88,6 @@ def Deserializer(object_list, **options):
|
||||
db = options.pop('using', DEFAULT_DB_ALIAS)
|
||||
ignore = options.pop('ignorenonexistent', False)
|
||||
|
||||
apps.populate_models()
|
||||
|
||||
for d in object_list:
|
||||
# Look up the model and starting build a dict of data for it.
|
||||
Model = _get_model(d["model"])
|
||||
|
||||
Reference in New Issue
Block a user