#task_histories_detail
This commit is contained in:
parent
9da2ba7f42
commit
52c8dbaa9c
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
import math
|
||||
|
||||
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
|
||||
from django.db import connection
|
||||
|
@ -151,13 +152,13 @@ def task_histories_detail(request, pk):
|
|||
paginator = Paginator(row, 10)
|
||||
page = int(request.GET.get('page', 1))
|
||||
try:
|
||||
row = paginator.page(page)
|
||||
rows = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
row = paginator.page(1)
|
||||
rows = paginator.page(1)
|
||||
except EmptyPage:
|
||||
row = paginator.page(paginator.num_pages)
|
||||
rows = paginator.page(paginator.num_pages)
|
||||
res = []
|
||||
for r in row:
|
||||
for r in rows:
|
||||
o = dict()
|
||||
o['id'] = r[0]
|
||||
o['task_id'] = r[1]
|
||||
|
@ -173,5 +174,6 @@ def task_histories_detail(request, pk):
|
|||
return HttpResponse(json.dumps({
|
||||
"status":"1",
|
||||
"res":res,
|
||||
"row":row,
|
||||
"count":len(row),
|
||||
"page_count":math.ceil(len(row)/10),
|
||||
}))
|
||||
|
|
Loading…
Reference in New Issue