* component: Database layer (models, ORM) => Core (Serialization)
* stage: Unreviewed => Accepted
Comment:
Thanks for the report.
Django doesn't need to search for an object in the database when you don't
use natural key, that's why it works.
When natural keys are used Django tries to find a matching object in the
database when building an instance based on JSON values. We could probably
avoid this with:
{{{#!diff
diff --git a/django/core/serializers/python.py
b/django/core/serializers/python.py
index 7ec894aa00..47606aa248 100644
--- a/django/core/serializers/python.py
+++ b/django/core/serializers/python.py
@@ -117,6 +117,8 @@ def Deserializer(
continue
else:
raise
+ if not router.allow_migrate_model(self.using, Model):
+ continue
data = {}
if "pk" in d:
try:
}}}
Does it work for you?
--
Ticket URL: <https://code.djangoproject.com/ticket/34907#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.