

class {{model_name}}ViewSet(viewsets.ModelViewSet):

    serializer_class = {{model_name}}Serializer
    permission_classes = (IsAuthenticated, )

    def get_queryset(self):
        queryset = {{model_name}}.objects.all()
        return queryset

    def get_serializer_class(self):
        {% if 'c' in actions %}
        if self.action == 'create':
            return {{model_name}}CreateSerializer
        {% endif %}
        {% if 'u' in actions %}
        if self.action == 'partial_update':
            return {{model_name}}UpdateSerializer
        {% endif %}
        {% if 'd' in actions %}
        if self.action == 'delete':
            return {{model_name}}DeleteSerializer
        {% endif %}
        return super().get_serializer_class()