[Answered ]-How to post the model with foreign key?

1👍

You set category=1 so Django expects to send a category object but if you need to send the id of the object, set category_id=1

curl -X POST -F file=@mypng.jpg -F 'category_id=1' http://localhost/items/

Leave a comment