DjangoRestMultipleModels icon indicating copy to clipboard operation
DjangoRestMultipleModels copied to clipboard

The Viewsets could support POST, PUT, PATCH, etc.

Open JonathanArns opened this issue 3 years ago • 2 comments

I think it would actually be a very nice API and is a use-case that I currently have. It would just do what a normal ModelViewset would do to each object individually. So for example in the object based viewset, you could just apply the appropriate serializer to each list of objects that is in the request. You know the appropriate serializer, because you are currently using it already to create the same lists when querying the current API.

This behavior would be unambiguous, wouldn't it? And seems pretty intuitive to me, personally.

JonathanArns avatar Nov 24 '21 08:11 JonathanArns

Hrm, I'm not opposed to the idea, but I think the act of choosing the serializer to use is not as obvious as you're making it out -- since the queryList has multiple possible serializers embedded in it, you'd need some explicit way of tagging which serializer is the correct one. I'm probably not going to work on implementing this myself, but if someone is able to present an elegant solution I'd be willing to accept a PR.

MattBroach avatar Feb 09 '22 14:02 MattBroach

Thanks for the feedback :) I am pretty busy with other stuff right now, but I might build an implementation of what I imagine this to be at some point so that we can see what rough edges it actually has.

JonathanArns avatar Mar 03 '22 17:03 JonathanArns