Created
December 17, 2014 11:19
-
-
Save claudep/cea224ff21a992fd848a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/django/db/models/base.py b/django/db/models/base.py | |
index c2f711e..dedfbee 100644 | |
--- a/django/db/models/base.py | |
+++ b/django/db/models/base.py | |
@@ -1659,6 +1659,8 @@ def model_unpickle(model_id, attrs, factory): | |
Used to unpickle Model subclasses with deferred fields. | |
""" | |
if isinstance(model_id, tuple): | |
+ if not apps.ready: | |
+ apps.populate(settings.INSTALLED_APPS) | |
model = apps.get_model(*model_id) | |
else: | |
# Backwards compat - the model was cached directly in earlier versions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment