Dona
unread,Nov 11, 2020, 8:47:29 AM11/11/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django REST framework
Hi Django REST Community,
I want to build a frontend and a backend. Within my frontend I would like to be able to create a new resource but with referencing already existing Movies or create new Movie instances. For instance via this post request:
{
"name": "Resource1",
"movie": [
{ "id": 0 },
{ "id": 1 },
{ "id": 2 },
{ "name": "New Movie 1", "description": "Simple description..." },
{ "name": "New Movie 2", "description": "Another description" },
]
}
Does this design makes sense or is there a better approach?
If so, do I then need to create 2 serializers one for post (create) and one for everything else? I could then use get_serializer_class to distinguish between the 2 serializers.
I would be happy to receive an opinion.
Kind regards,
Dona