#26291: loaddata cannot deserialize fixtures with forward references and natural
foreign keys
--------------------------------------+--------------------
Reporter: inglesp | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Serialization) | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
The following fixture cannot be deserialized, unless an Author object with
name "John Steinbeck" already exists. This is because when Django tries
to deserialize the first object, it tries to load an Author with name
"John Steinbeck", which fails.
{{{
[
{
"model": "app.book",
"fields": {
"title": "East Of Eden",
"author": ["John Steinbeck"]
}
},
{
"model": "app.author",
"fields": {
"name": "John Steinbeck",
"date_of_birth": "1902-02-27"
}
}
]
}}}
This problem is avoidable with careful ordering of fixture loading, but is
still a problem with fixtures that have circular references.
I have a proposed fix: see PR 6221
--
Ticket URL: <https://code.djangoproject.com/ticket/26291>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.b7a6d8fe197d927873b14bdbeac9ba93%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.