5👍
✅
One option is to handle both GET
and POST
with one detail_route
-decorated handler and to do additional dispatching inside the handler:
@detail_route(methods=['get', 'post'])
def photos(self, request):
if request.method == 'POST':
return self.new_photo(request)
return Response(self.get_photos())
Source:stackexchange.com