def list_instance_actions(self, request, pk=None): valid_actions = InstanceAction.filter_by_instance(pk) serializer_class = self.get_serializer_class() serialized_data = serializer_class( valid_actions, many=True, context={'request': request}).data return Response(serialized_data)