Ejemplo n.º 1
0
 def list(self, request, *args, **kwargs):
     """
     Method is overwritten in order to implement superuser check
     """
     if request.user.is_superuser:
         return ModelViewSet.list(self, request, *args, **kwargs)
     return Response("Only superuser can get resellers list", status=status.HTTP_403_FORBIDDEN)
Ejemplo n.º 2
0
    def list(self, request, *args, **kwargs):
        patient = request.query_params.get('patient')

        if patient != None:
            patient = Patient.objects.get(id=patient)
            queryset = self.get_queryset().filter(patient=patient)
            serializer = self.get_serializer(queryset, many=True)
            return Response(serializer.data)

        return ModelViewSet.list(self, request, *args, **kwargs)
Ejemplo n.º 3
0
    def list(self, request, *args, **kwargs):
        anamnesis = request.query_params.get('anamnesis')
        cell_extraction = request.query_params.get('cell_extraction')

        if anamnesis == None and cell_extraction != None:
            cell_extraction = CellExtraction.objects.get(id=cell_extraction)
            queryset = self.get_queryset().filter(
                cell_extraction=cell_extraction)
            serializer = self.get_serializer(queryset, many=True)
            return Response(serializer.data)
        elif cell_extraction == None and anamnesis != None:
            anamnesis = Anamnesis.objects.get(id=anamnesis)
            queryset = self.get_queryset().filter(
                anamnesis=anamnesis, cell_extraction=cell_extraction)
            serializer = self.get_serializer(queryset, many=True)
            return Response(serializer.data)
        elif cell_extraction != None and anamnesis != None:
            anamnesis = Anamnesis.objects.get(id=anamnesis)
            cell_extraction = CellExtraction.objects.get(id=cell_extraction)
            queryset = self.get_queryset().filter(
                anamnesis=anamnesis, cell_extraction=cell_extraction)
            serializer = self.get_serializer(queryset, many=True)
            return Response(serializer.data)
        return ModelViewSet.list(self, request, *args, **kwargs)
Ejemplo n.º 4
0
 def list(self, request, *args, **kwargs):
     queryset = Resume.objects.filter(author=request.user)
     return ModelViewSet.list(self, request, *args, **kwargs)
Ejemplo n.º 5
0
 def list(self, request, *args, **kwargs):
     return ModelViewSet.list(self, request, *args, **kwargs)
Ejemplo n.º 6
0
 def list(self, request, *args, **kwargs):
     return ModelViewSet.list(self, request, *args, **kwargs)
 def list(self, request):
     return ModelViewSet.list(self, request)
Ejemplo n.º 8
0
 def list(self, request, *args, **kwargs):
     queryset = Resume.objects.filter(author=request.user)
     return ModelViewSet.list(self, request, *args, **kwargs)