更新我的提交列表页面
This commit is contained in:
1
submission/templatetags/__init__.py
Normal file
1
submission/templatetags/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# coding=utf-8
|
||||
28
submission/templatetags/submission.py
Normal file
28
submission/templatetags/submission.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# coding=utf-8
|
||||
|
||||
|
||||
def translate_result(value):
|
||||
print value
|
||||
results = {
|
||||
0: "Accepted",
|
||||
1: "Runtime Error",
|
||||
2: "Time Limit Exceeded",
|
||||
3: "Memory Limit Exceeded",
|
||||
4: "Compile Error",
|
||||
5: "Format Error",
|
||||
6: "Wrong Answer",
|
||||
7: "System Error",
|
||||
8: "Waiting"
|
||||
}
|
||||
return results[value]
|
||||
|
||||
|
||||
def translate_id(submission_item):
|
||||
print submission_item
|
||||
return submission_item["_id"]
|
||||
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
register.filter("translate_result", translate_result)
|
||||
register.filter("translate_id", translate_id)
|
||||
@@ -69,9 +69,9 @@ class SubmissionnAPIView(APIView):
|
||||
def problem_my_submissions_list_page(request, problem_id):
|
||||
collection = _create_mondodb_connection()
|
||||
submissions = collection.find({"problem_id": int(problem_id), "user_id": request.user.id},
|
||||
projection=["result", "accepted_answer_info", "create_time"],
|
||||
projection=["result", "accepted_answer_info", "create_time", "language"],
|
||||
sort=[["create_time", -pymongo.ASCENDING]])
|
||||
return render(request, "oj/problem/my_solutions_list.html", {"submissions": submissions})
|
||||
return render(request, "oj/problem/my_submissions_list.html", {"submissions": submissions})
|
||||
|
||||
|
||||
def my_submission(request, solution_id):
|
||||
|
||||
Reference in New Issue
Block a user