Exemplo n.º 1
0
    def create(self, request):
        serializer = PublicSignalCreateSerializer(
            data=request.data, context=self.get_serializer_context())
        serializer.is_valid(raise_exception=True)
        signal = serializer.save()

        data = PublicSignalSerializerDetail(
            signal, context=self.get_serializer_context()).data
        return Response(data, status=status.HTTP_201_CREATED)
Exemplo n.º 2
0
    def retrieve(self, request, uuid):
        signal = Signal.objects.get(uuid=uuid)

        data = PublicSignalSerializerDetail(
            signal, context=self.get_serializer_context()).data
        return Response(data)