def METHOD_NAME(self):
    if self.request.method == 'GET':
        if self.action == 'list':
            return serializers.TaskListSerializer
        return serializers.TaskDetailSerializer
    return serializers.TaskSerializer