def List(self, request, context): clientes = Cliente.objects.all() serializer = ClienteProtoSerializer(clientes, many=True) for msg in serializer.message: yield msg
def Retrieve(self, request, context): cliente = self.get_object(request.cd_cliente) serializer = ClienteProtoSerializer(cliente) return serializer.message
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
def Create(self, request, context): serializer = ClienteProtoSerializer(message=request) serializer.is_valid(raise_exception=True) serializer.save() return serializer.message