修改逻辑

This commit is contained in:
virusdefender 2015-09-22 14:37:45 +08:00
parent 5ac16a3c7f
commit f0a70c3b09
3 changed files with 6 additions and 4 deletions

View File

@ -161,11 +161,13 @@ def my_submission_list_page(request, page=1):
""" """
我的所有提交的列表页 我的所有提交的列表页
""" """
submissions = Submission.objects.filter(user_id=request.user.id, contest_id__isnull=True). \
values("id", "user_id", "problem_id", "result", "create_time", "accepted_answer_time", "language").order_by("-create_time")
# 显示所有人的提交 这是管理员的调试功能 # 显示所有人的提交 这是管理员的调试功能
show_all = request.GET.get("show_all", False) == "true" show_all = request.GET.get("show_all", False) == "true"
if show_all:
submissions = Submission.objects.filter(contest_id__isnull=True)
else:
submissions = Submission.objects.filter(user_id=request.user.id, contest_id__isnull=True)
submissions = submissions.values("id", "user_id", "problem_id", "result", "create_time", "accepted_answer_time", "language").order_by("-create_time")
language = request.GET.get("language", None) language = request.GET.get("language", None)
filter = None filter = None

View File

@ -29,7 +29,6 @@
<tr> <tr>
<th scope="row"> <th scope="row">
<a href="/submission/{{ item.id }}/">{{ forloop.counter }}</a> <a href="/submission/{{ item.id }}/">{{ forloop.counter }}</a>
{% if show_all %}{{ item.user.username }}{% endif %}
</th> </th>
<td>{{ item.create_time }}</td> <td>{{ item.create_time }}</td>
<td> <td>

View File

@ -52,6 +52,7 @@
<tr> <tr>
<th scope="row"> <th scope="row">
<a href="/submission/{{ item.id }}/">{{ forloop.counter |add:start_id }}</a> <a href="/submission/{{ item.id }}/">{{ forloop.counter |add:start_id }}</a>
{% if show_all %}{{ item.user.username }}{% endif %}
</th> </th>
<td> <td>
<a href="/problem/{{ item.problem_id }}/">{{ item.title }}</a> <a href="/problem/{{ item.problem_id }}/">{{ item.title }}</a>