From 195761023986468422b2ee3b4336c61692576cd3 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sun, 13 Sep 2015 13:14:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E6=AF=94=E8=B5=9B?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=93=BE=E6=8E=A5=E6=98=BE=E7=A4=BA=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest_submission/views.py | 15 ++- template/src/oj/contest/submissions_list.html | 107 ++++++++-------- .../oj/contest/submissions_list_admin.html | 114 ------------------ 3 files changed, 63 insertions(+), 173 deletions(-) delete mode 100644 template/src/oj/contest/submissions_list_admin.html diff --git a/contest_submission/views.py b/contest_submission/views.py index 765d116e..6c0edb3f 100644 --- a/contest_submission/views.py +++ b/contest_submission/views.py @@ -120,12 +120,15 @@ def contest_problem_submissions_list_page(request, contest_id, page=1): except Exception: pass - # 如果该用户是超级管理员那么他可以查看所有的提交记录详情 - if request.user.admin_type > 1: - return render(request, "oj/contest/submissions_list_admin.html", - {"submissions": current_page, "page": int(page), - "previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20, - "contest": contest}) + for item in current_page: + if item.user_id == request.user.id: + setattr(item, "show_link", True) + elif request.user.admin_type == SUPER_ADMIN or request.user: + setattr(item, "show_link", True) + elif request.user == contest.created_by: + setattr(item, "show_link", True) + else: + setattr(item, "show_link", False) return render(request, "oj/contest/submissions_list.html", {"submissions": current_page, "page": int(page), diff --git a/template/src/oj/contest/submissions_list.html b/template/src/oj/contest/submissions_list.html index 1424bb10..973f2e2f 100644 --- a/template/src/oj/contest/submissions_list.html +++ b/template/src/oj/contest/submissions_list.html @@ -21,58 +21,59 @@ - - - - - - - - - - - - - {% if submissions %} +
#题目名称用户提交时间 - - 运行时间 - -
+ + + + + + + + + + + + {% if submissions %} {% for item in submissions %} - {% ifequal item.user_id request.user.id %} - - {% else %} - - {% endifequal %} + @@ -94,10 +95,10 @@ {% endfor %} - {% else %} -

本场比赛还没有提交记录

- {% endif %} -
#题目名称用户提交时间 + + 运行时间 + +
- {{ forloop.counter |add:start_id }}{{ forloop.counter |add:start_id }} + {% if item.show_link %} + {{ forloop.counter |add:start_id }} + {% else %} + {{ forloop.counter |add:start_id }} + {% endif %} + {{ item.title }}
+ {% else %} +

本场比赛还没有提交记录

+ {% endif %} +