Example #1
0
    def update(self, request, org, instance, ix, routeserver, *args, **kwargs):
        serializer = Serializers.rs(data=request.data,
                                    instance=routeserver,
                                    context={"instance": instance})
        if not serializer.is_valid():
            return BadRequest(serializer.errors)

        routeserver = serializer.save()

        return Response(Serializers.rs(instance=routeserver).data)
Example #2
0
    def create(self, request, org, instance, ix, *args, **kwargs):
        data = request.data
        data["ix"] = models.InternetExchange.objects.get(instance=instance,
                                                         id=ix.pk).id
        serializer = Serializers.rs(data=data, context={"instance": instance})
        if not serializer.is_valid():
            return BadRequest(serializer.errors)

        routeserver = serializer.save()

        return Response(Serializers.rs(instance=routeserver).data)
Example #3
0
    def list(self, request, org, instance, ix, *args, **kwargs):
        queryset = self.get_queryset().order_by("name")
        ordering_filter = CaseInsensitiveOrderingFilter(
            ["name", "asn", "router_id"])
        queryset = ordering_filter.filter_queryset(request, queryset, self)

        serializer = Serializers.rs(
            instance=queryset,
            many=True,
        )

        return Response(serializer.data)
Example #4
0
 def destroy(self, request, org, instance, ix, routeserver, *args,
             **kwargs):
     r = Response(Serializers.rs(instance=routeserver).data)
     routeserver.delete()
     return r