添加了题目列表每个题目前边状态指示标志:ac /没有/正在进行,因为数据是存在用户表里的所以缓存的时候可以做到与题目数据分开

This commit is contained in:
sxw@401
2015-09-15 16:41:13 +08:00
parent 0683d0914b
commit 01215a71ad
7 changed files with 62 additions and 3 deletions

View File

@@ -282,11 +282,16 @@ def problem_list_page(request, page=1):
except Exception:
pass
if request.user.is_authenticated() and request.user.problems_status:
problems_status = json.loads(request.user.problems_status)
else:
problems_status = {}
print problems_status
# 右侧标签列表 按照关联的题目的数量排序 排除题目数量为0的
tags = ProblemTag.objects.annotate(problem_number=Count("problem")).filter(problem_number__gt=0).order_by("-problem_number")
return render(request, "oj/problem/problem_list.html",
{"problems": current_page, "page": int(page),
"previous_page": previous_page, "next_page": next_page,
"keyword": keyword, "tag": tag_text,
"keyword": keyword, "tag": tag_text,"problems_status": problems_status,
"tags": tags, "difficulty_order": difficulty_order})