def get(self, request, *args, **kwargs): query_params = dict() for k in request.query_params.keys(): if k not in ["offset"]: query_params[k] = request.query_params.get(k) if request.user.is_superuser and query_params: logs_list = SQL_Execute_Histroy.objects.filter(**query_params) elif not request.user.is_superuser and query_params: query_params["exe_user"] = request.user.first_name logs_list = SQL_Execute_Histroy.objects.filter(**query_params) elif request.user.is_superuser: logs_list = SQL_Execute_Histroy.objects.all() else: query_params["exe_user"] = request.user.first_name logs_list = SQL_Execute_Histroy.objects.filter(**query_params) page = serializers.PageConfig() # 注册分页 page_user_list = page.paginate_queryset(queryset=logs_list, request=request, view=self) ser = serializers.HistroySQLSerializer(instance=page_user_list, many=True) return page.get_paginated_response(ser.data)
def get(self,request,*args,**kwargs): query_params = dict() for ds in request.query_params.keys(): if ds in ['offset']:continue query_params[ds] = request.query_params.get(ds) if query_params: logs_list = Log_Deploy_Playbook.objects.filter(**query_params) else: logs_list = Log_Deploy_Playbook.objects.all() page = serializers.PageConfig() # 注册分页 page_user_list = page.paginate_queryset(queryset=logs_list, request=request, view=self) ser = serializers.DeployPlaybookLogsSerializer(instance=page_user_list, many=True) return page.get_paginated_response(ser.data)
def get(self, request, *args, **kwargs): if request.user.is_superuser: ordersList = Order_System.objects.all().order_by("-id") else: ordersList = Order_System.objects.filter( Q(order_user=request.user.id) | Q(order_executor=request.user.id)).order_by("-id") page = serializers.PageConfig() # 注册分页 page_user_list = page.paginate_queryset(queryset=ordersList, request=request, view=self) ser = serializers.OrderSerializer(instance=page_user_list, many=True) return page.get_paginated_response(ser.data)
def get(self, request, *args, **kwargs): try: jobs = Sched_Job_Config.objects.get( id=request.query_params.get("id")) except Exception as ex: return Response(str(ex), status=status.HTTP_400_BAD_REQUEST) jobs_logs_list = Sched_Job_Logs.objects.filter(job_id=jobs) page = serializers.PageConfig() # 注册分页 page_user_list = page.paginate_queryset(queryset=jobs_logs_list, request=request, view=self) ser = serializers.ApschedNodeJobsLogsSerializer( instance=page_user_list, many=True) return page.get_paginated_response(ser.data)
def get(self, request, *args, **kwargs): query_params = dict() for ds in request.query_params.keys(): query_params[ds] = request.query_params.get(ds) try: ipvs_list = IPVS_CONFIG.objects.filter(**query_params) except Exception as ex: return Response(str(ex), status=status.HTTP_400_BAD_REQUEST) page = serializers.PageConfig() # 注册分页 page_user_list = page.paginate_queryset(queryset=ipvs_list, request=request, view=self) ser = serializers.IPVSSerializer(instance=page_user_list, many=True) return page.get_paginated_response(ser.data)
def get(self,request,*args,**kwargs): logs_list = Log_Project_Config.objects.filter(project=request.query_params.get('pid')) page = serializers.PageConfig() # 注册分页 page_user_list = page.paginate_queryset(queryset=logs_list, request=request, view=self) ser = serializers.AppsLogsSerializer(instance=page_user_list, many=True) return page.get_paginated_response(ser.data)