Writable Nested Serializers Error in POST - Invalid Pk - object does not exist

I’m working on writable nested serializers. I want to enter data containing 2 tables — request, and parts in one request.

I was able to do serialization but as I try to POST a request, it sends me an error throwing that an object does not exist. Probably because parts has foreign key referencing to request.

What could be a solution for this?

Here’s my code for reference: https://dpaste.org/kYgGf

You are posting "ID0000001" as "requestid" and you are supposed post an integer, like 1.

Back to Top