Access to primary keys #300
RobertoMaurizzi
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi @RobertoMaurizzi you can construct a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Not opening an issue because it might be I'm simply missing something...
In "modern" API web programming it's common practice to send and receive primary keys (integers, text, etc.) from the clients: for example you send data including the pk to the client, then the client posts back to a record creation endpoint to create a new record including the pks of other records that are linked to the current one, like in the Blog/Post/Comment examples.
However the client knows for sure which Blog it's serving, so I'd like to create the Post without accessing the database to fetch again the Blog record simply to feed it to a ForeignKey field.
Similar to how in Django you can have
related_record
that takes an Object of the related type, andrelated_record_id
that allows to set the fk value and that's it.Is there a way to do that that I've mssed?
Beta Was this translation helpful? Give feedback.
All reactions