-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pick doesn't serialise ids correctly for nested model properties #325
Comments
That's nuts, I can't even imagine why it would happen. You're not going through the Pick layer for the Should be pretty easy to reproduce with a test in |
Realised that my design was probably flawed here. Instead I opted to use pick on the child and do the query on the view & this bug doesn't happen there:
And then doing the fetch within the view:
|
You can also just do the reverse relationship, far easier: Add Then just pick right at the parent level:
And you only need to load the parent and pass it to the template. Magic! PS. Technically you don't need a related name, just |
I found an issue with serialisation where parent id overrides children ids during serialisation.
Example
Assume I have the following 2 models and a property in the parent which extract data from the child:
Template:
Now assume I have ParentModel (id:1) linked to two ChildModels (id:20 & id: 25)
When I print
children_info
on django side I get the ids as expected:However, on client side the parent id overrides the children ids:
Temporary Fix
Changing the definition of ChildInfo fixed the issue:
And I correctly get the same output on both django and client side:
Question
Is there an issue with serialisation when a name clash between ids happens?
The text was updated successfully, but these errors were encountered: