def fetch_pending(self, deleted):
        if (not deleted):
            objs = MonitoringChannel.get_tenant_objects().filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
        else:
            objs = MonitoringChannel.get_deleted_tenant_objects()

        return objs
Esempio n. 2
0
    def fetch_pending(self, deleted):
        if (not deleted):
            objs = MonitoringChannel.get_tenant_objects().filter(
                Q(enacted__lt=F('updated')) | Q(enacted=None),
                Q(lazy_blocked=False))
        else:
            objs = MonitoringChannel.get_deleted_tenant_objects()

        return objs
Esempio n. 3
0
    def get_queryset(self):
        queryset = MonitoringChannel.get_tenant_objects().select_related().all()

        current_user = self.request.user.username
        if current_user is not None:
            ids = [x.id for x in queryset if x.creator.username==current_user]
            queryset = queryset.filter(id__in=ids)

        return queryset
Esempio n. 4
0
    def get_queryset(self):
        queryset = MonitoringChannel.get_tenant_objects().select_related().all(
        )

        current_user = self.request.user.username
        if current_user is not None:
            ids = [
                x.id for x in queryset if x.creator.username == current_user
            ]
            queryset = queryset.filter(id__in=ids)

        return queryset
Esempio n. 5
0
    def post(self, request, format=None):
        current_user = request.user.username
        existing_obj = None
        for obj in MonitoringChannel.get_tenant_objects().all():
            if (obj.creator.username == current_user):
                existing_obj = obj
                break

        if existing_obj:
            serializer = MonitoringChannelSerializer(existing_obj)
            headers = self.get_success_headers(serializer.data)
            return Response(serializer.data, status=status.HTTP_200_OK)

        return super(MonitoringChannelList, self).post(request, format)
Esempio n. 6
0
    def post(self, request, format=None):
        current_user = request.user.username
        existing_obj = None
        for obj in MonitoringChannel.get_tenant_objects().all():
            if (obj.creator.username == current_user):
               existing_obj = obj
               break

        if existing_obj:
            serializer = MonitoringChannelSerializer(existing_obj)
            headers = self.get_success_headers(serializer.data)
            return Response( serializer.data, status=status.HTTP_200_OK )

        return super(MonitoringChannelList, self).post(request, format)
Esempio n. 7
0
class MonitoringChannelDetail(XOSRetrieveUpdateDestroyAPIView):
    serializer_class = MonitoringChannelSerializer
    queryset = MonitoringChannel.get_tenant_objects().select_related().all()

    method_kind = "detail"
    method_name = "monitoringchannel"