标签:传递 obj request view div 前端 数据 django cts
1 from rest_framework.views import APIView 2 3 4 class GetLinkListDataJson(APIView): 5 """ 6 列表页获取table信息,包含分页 7 """ 8 def get(self, request): 9 page = int(request.GET.get(‘page‘, 1)) 10 size = int(request.GET.get(‘size‘, 10)) 11 data = Link.objects.values() 12 # 用切片获取需要的值 13 num = (page-1)*size 14 json_data = data[num:num+size] 15 # count传递给前端,区分页数, data为前端列表页展示数据 16 return JsonResponse(count=len(data), data=json_data)
标签:传递 obj request view div 前端 数据 django cts
原文地址:https://www.cnblogs.com/nieliangcai/p/12844080.html