Ejemplo n.º 1
0
 def get(self, request, args: str = None):
     page = request.GET.get('page')
     page_number = query_order.objects.count()
     start = int(page) * 20 - 20
     end = int(page) * 20
     info = query_order.objects.all().order_by('-id')[start:end]
     serializers = Query_review(info, many=True)
     return Response({'page': page_number, 'data': serializers.data})
Ejemplo n.º 2
0
 def get(self, request, args: str = None):
     page = request.GET.get('page')
     pn = query_order.objects.filter(audit=request.user).count()
     start = int(page) * 10 - 10
     end = int(page) * 10
     user_list = query_order.objects.all().order_by('-id')[start:end]
     serializers = Query_review(user_list, many=True)
     return Response({'data': serializers.data, 'pn': pn})
Ejemplo n.º 3
0
 def get(self, request, args: str = None):
     if request.GET.get('type') and request.GET.get('type') == "myorder":
         page_size = 5
         page = request.GET.get('page')
         pn = query_order.objects.filter(username=request.user).count()
         start = int(page) * page_size - page_size
         end = int(page) * page_size
         user_list = query_order.objects.filter(
             username=request.user).order_by('-id')[start:end]
         serializers = Query_review(user_list, many=True)
         return Response({'data': serializers.data, 'pn': pn})
     else:
         page = request.GET.get('page')
         pn = query_order.objects.filter(audit=request.user).count()
         start = int(page) * 10 - 10
         end = int(page) * 10
         user_list = query_order.objects.filter(
             audit=request.user).order_by('-id')[start:end]
         serializers = Query_review(user_list, many=True)
         return Response({'data': serializers.data, 'pn': pn})
Ejemplo n.º 4
0
 def get(self, request, args: str = None):
     page = request.GET.get('page')
     qurey = json.loads(request.GET.get('query'))
     start = int(page) * 20 - 20
     end = int(page) * 20
     if qurey['valve']:
         if len(qurey['picker']) == 0:
             info = query_order.objects.filter(username__contains=qurey['user']).order_by(
                 '-id')[
                    start:end]
             page_number = query_order.objects.filter(username__contains=qurey['user']).only('id').count()
         else:
             picker = []
             for i in qurey['picker']:
                 picker.append(i)
             info = query_order.objects.filter(username__contains=qurey['user'], date__gte=picker[0],
                                               date__lte=picker[1]).order_by('-id')[start:end]
             page_number = query_order.objects.filter(username__contains=qurey['user'], date__gte=picker[0],
                                                      date__lte=picker[1]).only('id').count()
     else:
         info = query_order.objects.all().order_by('-id')[start:end]
         page_number = query_order.objects.only('id').count()
     serializers = Query_review(info, many=True)
     return Response({'page': page_number, 'data': serializers.data})