<s> from rest_framework import viewsets , status <EOL> from rest_framework . response import Response <EOL> from crowdsourcing . serializers . template import * <EOL> class TemplateViewSet ( viewsets . ModelViewSet ) : <EOL> from crowdsourcing . models import Template <EOL> queryset = Template . objects . all ( ) <EOL> serializer_class = TemplateSerializer <EOL> class TemplateItemViewSet ( viewsets . ModelViewSet ) : <EOL> from crowdsourcing . models import TemplateItem <EOL> queryset = TemplateItem . objects . all ( ) <EOL> serializer_class = TemplateItemSerializer <EOL> def update ( self , request , * args , ** kwargs ) : <EOL> instance = self . get_object ( ) <EOL> item_serializer = TemplateItemSerializer ( instance = instance , data = request . data , partial = True ) <EOL> if item_serializer . is_valid ( ) : <EOL> item_serializer . update ( instance = instance , validated_data = item_serializer . validated_data ) <EOL> return Response ( data = { "<STR_LIT:message>" : "<STR_LIT>" } , status = status . HTTP_200_OK ) <EOL> else : <EOL> return Response ( data = item_serializer . errors , status = status . HTTP_400_BAD_REQUEST ) <EOL> class TemplateItemPropertiesViewSet ( viewsets . ModelViewSet ) : <EOL> from crowdsourcing . models import TemplateItemProperties <EOL> queryset = TemplateItemProperties . objects . all ( ) <EOL> serializer_class = TemplateItemPropertiesSerializer </s>
