示例#1
0
 def List(self, request, context):
     clientes = Cliente.objects.all()
     serializer = ClienteProtoSerializer(clientes, many=True)
     for msg in serializer.message:
         yield msg
示例#2
0
 def Retrieve(self, request, context):
     cliente = self.get_object(request.cd_cliente)
     serializer = ClienteProtoSerializer(cliente)
     return serializer.message
示例#3
0
 def Update(self, request, context):
     cliente = self.get_object(request.cd_cliente)
     serializer = ClienteProtoSerializer(cliente, message=request)
     serializer.is_valid(raise_exception=True)
     serializer.save()
     return serializer.message
示例#4
0
 def Create(self, request, context):
     serializer = ClienteProtoSerializer(message=request)
     serializer.is_valid(raise_exception=True)
     serializer.save()
     return serializer.message