Suppose, we have a ViewSet class:
class SomeViewSet(viewsets.ViewSet):
def create(self, request):
pass
def custom_action(self, request):
pass
and we register SomeViewSet
as follows:
some_router = DefaultRouter()
some_router.register(r'some-route', SomeViewSet, basename='some-name')
So, now we have the SomeViewSet
with the standard action create
, which will be accessible with the route some-route/
using POST
HTTP method.
The question is how to configure the custom_action
action to be accessible by the same route as a standard create
action (some-route/
) with the PUT
HTTP method.