def get(self, request, pk, *args, **kwargs): queryset = models.Course.objects.filter(id=pk) print(queryset) serializer_class = CourseChapterModelSerializer data = SerializedData(request, queryset, serializer_class).get_data() print(data) return Response(data)
def list(self, request, *args, **kwargs): """ Ansible列表 :param request: :param args: :param kwargs: :return: """ queryset = models.AnsibleGroup.objects.all() # print(queryset.values()) serializer_class = AnsibleSerializer data = SerializedData(request, queryset, serializer_class).get_data() return HttpResponse(json.dumps(data))
def list(self, request, *args, **kwargs): """ 书籍列表 :param request: :param args: :param kwargs: :return: """ queryset = models.Book.objects.all() serializer_class = BookSerializer data = SerializedData(request, queryset, serializer_class).get_data() return Response(data)
def get_msg(self, request,pk, *args, **kwargs): """ 主机信息 :param request: :param args: :param kwargs: :return: """ queryset = models.Host.objects.filter(id=pk) # print(queryset.values()) serializer_class = HostSerializer data = SerializedData(request, queryset, serializer_class).get_data() return HttpResponse(json.dumps(data))
def list(self, request, *args, **kwargs): """ 主机列表 :param request: :param args: :param kwargs: :return: """ queryset = models.Host.objects.all() # print(queryset.values()) serializer_class = HostListSerializer data = SerializedData(request, queryset, serializer_class).get_data() # print(data) # if not data: return HttpResponse(json.dumps(data))
def get_msg(self, request, pk, *args, **kwargs): """ 磁盘信息 :param request: :param args: :param kwargs: :return: """ queryset = models.Disk.objects.filter(host_id=pk) # print(queryset.values()) serializer_class = DiskSerializer data = SerializedData(request, queryset, serializer_class).get_data() # print(data) # if not data: return HttpResponse(json.dumps(data))
def get(self, request, pk, *args, **kwargs): queryset = models.Course.objects.filter(degree_course_id=pk) serializer_class = CourseModuleModelSerializer data = SerializedData(request, queryset, serializer_class).get_data() return Response(data)
def get(self, request, *args, **kwargs): queryset = models.Course.objects.all() serializer_class = CourseThematicModelSerializer data = SerializedData(request, queryset, serializer_class).get_data() return Response(data)
def get(self, request, *args, **kwargs): # response = {'code':1000,'data':None,'error':None} queryset = models.Course.objects.all() serializer_class = CourseModelSerializer data = SerializedData(request, queryset, serializer_class).get_data() return Response(data)