The DRF documentation shows how to connect a renderer to an APIView, but not how to do it for a specific action in a ViewSet. Given:
class XViewSet(ViewSet):
serializer_class = XSerializer
@action(detail=True, methods=['get'])
def my_action(self, request, pk=None):
..
How do I set a specific renderer for my_action
, that will not affect the other/default actions in the viewset?
I can make an APIView just for that action of course but that makes for a more messy urls.py
As far as I can tell, the
action
takes any argument that can be a class attribute: