- | {{ forloop.counter }} |
+ {{ forloop.counter }} |
{{ item.create_time }} |
{{ item.result|translate_result }} |
diff --git a/template/oj/contest/submissions_list.html b/template/oj/contest/submissions_list.html
new file mode 100644
index 0000000..6635219
--- /dev/null
+++ b/template/oj/contest/submissions_list.html
@@ -0,0 +1,80 @@
+{% extends 'oj_base.html' %}
+
+{% block body %}
+
+{% load submission %}
+
+
+ {% if submissions %}
+
+
+
+ | # |
+ 提交时间 |
+ 结果 |
+ 运行时间 |
+ 语言 |
+
+
+
+ {% for item in submissions %}
+
+
+ {% ifequal item.user_id request.user.id %}
+ |
+ {{ forloop.counter |add:start_id }} |
+ {% else %}
+ {{ forloop.counter |add:start_id }} |
+ {% endifequal %}
+
+ {{ item.create_time }} |
+ {{ item.result|translate_result }} |
+
+ {% if item.accepted_answer_time %}
+ {{ item.accepted_answer_time }}ms
+ {% else %}
+ --
+ {% endif %}
+ |
+
+ {{ item.language|translate_language }}
+ |
+
+ {% endfor %}
+
+
+
+ {% else %}
+ 你还没有提交记录!
+ {% endif %}
+
+
+{% endblock %}
diff --git a/template/oj/problem/my_submission.html b/template/oj/problem/my_submission.html
index 1aca690..2e361f5 100644
--- a/template/oj/problem/my_submission.html
+++ b/template/oj/problem/my_submission.html
@@ -11,8 +11,19 @@
-
- 题目
- - 我的提交
+ {% if submission.contest_id %}
+ 题目
+ {% else %}
+ 题目
+ {% endif %}
+
+ -
+ {% if submission.contest_id %}
+ 我的提交
+ {% else %}
+ 我的提交
+ {% endif %}
+
{% include "oj/problem/_problem_header.html" %}
diff --git a/template/oj/problem/my_submissions_list.html b/template/oj/problem/my_submissions_list.html
index 8a9a235..fb07a4c 100644
--- a/template/oj/problem/my_submissions_list.html
+++ b/template/oj/problem/my_submissions_list.html
@@ -8,13 +8,9 @@
题目
- 我的提交
+ 我的提交
- {{ problem.title }}
-
- 发布时间: {{ problem.create_time }}
- 时间限制: {{ problem.time_limit }}ms
- 内存限制: {{ problem.memory_limit }}M
+ {% include "oj/problem/_problem_header.html" %}
@@ -28,7 +24,7 @@
{% for item in submissions %}
- | {{ forloop.counter }} |
+ {{ forloop.counter }} |
{{ item.create_time }} |
{{ item.result|translate_result }} |
diff --git a/template/oj/problem/problem.html b/template/oj/problem/problem.html
index 5a7d847..2efd86a 100644
--- a/template/oj/problem/problem.html
+++ b/template/oj/problem/problem.html
@@ -5,7 +5,7 @@
{% include "oj/problem/_problem_header.html" %}
diff --git a/template/oj/submission/my_submissions_list.html b/template/oj/submission/my_submissions_list.html
index 4b939ec..279bee6 100644
--- a/template/oj/submission/my_submissions_list.html
+++ b/template/oj/submission/my_submissions_list.html
@@ -44,12 +44,12 @@
diff --git a/template/oj_base.html b/template/oj_base.html
index 61b887a..082cad5 100644
--- a/template/oj_base.html
+++ b/template/oj_base.html
@@ -43,7 +43,7 @@
From e6a4051067810007b60479176162caffe9bd636f Mon Sep 17 00:00:00 2001
From: virusdefender <1670873886@qq.com>
Date: Tue, 25 Aug 2015 10:34:47 +0800
Subject: [PATCH 13/16] fix js format
---
.../src/js/app/admin/problem/edit_problem.js | 79 ++++++++++---------
1 file changed, 43 insertions(+), 36 deletions(-)
diff --git a/static/src/js/app/admin/problem/edit_problem.js b/static/src/js/app/admin/problem/edit_problem.js
index 26ab794..72a6b7c 100644
--- a/static/src/js/app/admin/problem/edit_problem.js
+++ b/static/src/js/app/admin/problem/edit_problem.js
@@ -2,7 +2,8 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
function ($, avalon, editor, uploader, bsAlert, csrfTokenHeader) {
avalon.ready(function () {
- avalon.vmodels.editProblem = null;
+
+
$("#edit-problem-form").validator()
.on('submit', function (e) {
@@ -76,42 +77,48 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
}
});
- var vm = avalon.define({
- $id: "editProblem",
- title: "",
- description: "",
- timeLimit: -1,
- memoryLimit: -1,
- samples: [],
- hint: "",
- visible: true,
- difficulty: 0,
- inputDescription: "",
- outputDescription: "",
- testCaseIdd: "",
- uploadSuccess: false,
- source: "",
- testCaseList: [],
- addSample: function () {
- vm.samples.push({input: "", output: "", "visible": true});
- },
- delSample: function (sample) {
- if (confirm("你确定要删除么?")) {
- vm.samples.remove(sample);
+ if(avalon.vmodels.editProblem){
+ var vm = avalon.vmodels.editProblem;
+ }
+ else {
+ var vm = avalon.define({
+ $id: "editProblem",
+ title: "",
+ description: "",
+ timeLimit: -1,
+ memoryLimit: -1,
+ samples: [],
+ hint: "",
+ visible: true,
+ difficulty: 0,
+ inputDescription: "",
+ outputDescription: "",
+ testCaseIdd: "",
+ uploadSuccess: false,
+ source: "",
+ testCaseList: [],
+ addSample: function () {
+ vm.samples.push({input: "", output: "", "visible": true});
+ },
+ delSample: function (sample) {
+ if (confirm("你确定要删除么?")) {
+ vm.samples.remove(sample);
+ }
+ },
+ toggleSample: function (sample) {
+ sample.visible = !sample.visible;
+ },
+ getBtnContent: function (item) {
+ if (item.visible)
+ return "折叠";
+ return "展开";
+ },
+ showProblemListPage: function () {
+ vm.$fire("up!showProblemListPage");
}
- },
- toggleSample: function (sample) {
- sample.visible = !sample.visible;
- },
- getBtnContent: function (item) {
- if (item.visible)
- return "折叠";
- return "展开";
- },
- showProblemListPage: function(){
- vm.$fire("up!showProblemListPage");
- }
- });
+ });
+
+ }
var hintEditor = editor("#hint");
var descriptionEditor = editor("#problemDescription");
var testCaseUploader = uploader("#testCaseFile", "/api/admin/test_case_upload/", function (file, response) {
From fa5f7a0b38576bfe8216c6c1b8b3d544c0263f10 Mon Sep 17 00:00:00 2001
From: virusdefender <1670873886@qq.com>
Date: Tue, 25 Aug 2015 10:43:02 +0800
Subject: [PATCH 14/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=B1=E8=B4=A5?=
=?UTF-8?q?=E7=9A=84=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
submission/tests.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/submission/tests.py b/submission/tests.py
index a9b6de1..e745bde 100644
--- a/submission/tests.py
+++ b/submission/tests.py
@@ -26,27 +26,27 @@ class SubmissionsListPageTest(TestCase):
def test_visit_submissionsListPage_successfully(self):
self.client.login(username="gogoing", password="666666")
- response = self.client.get('/my_submissions/1/')
+ response = self.client.get('/submissions/1/')
self.assertEqual(response.status_code, 200)
def test_visit_submissionsListPage_without_page_successfully(self):
self.client.login(username="gogoing", password="666666")
- response = self.client.get('/my_submissions/')
+ response = self.client.get('/submissions/')
self.assertEqual(response.status_code, 200)
def test_submissionsListPage_does_not_exist(self):
self.client.login(username="gogoing", password="666666")
- response = self.client.get('/my_submissions/5/')
+ response = self.client.get('/submissions/5/')
self.assertTemplateUsed(response, "utils/error.html")
def test_submissionsListPage_page_not_exist(self):
self.client.login(username="gogoing", password="666666")
- response = self.client.get('/my_submissions/5/')
+ response = self.client.get('/submissions/5/')
self.assertTemplateUsed(response, "utils/error.html")
def test_submissionsListPage_have_no_submission(self):
self.client.login(username="cool", password="666666")
- response = self.client.get('/my_submissions/')
+ response = self.client.get('/submissions/')
self.assertEqual(response.status_code, 200)
From c5d5aa87c49e7100d37fd9b094a65c7cba0e6c2d Mon Sep 17 00:00:00 2001
From: virusdefender <1670873886@qq.com>
Date: Tue, 25 Aug 2015 10:56:40 +0800
Subject: [PATCH 15/16] =?UTF-8?q?=E5=88=A0=E9=99=A4=20print?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
contest_submission/views.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/contest_submission/views.py b/contest_submission/views.py
index 192e331..0dba7cb 100644
--- a/contest_submission/views.py
+++ b/contest_submission/views.py
@@ -109,8 +109,6 @@ def contest_problem_submissions_list_page(request, contest_id, page=1):
except Exception:
pass
- print current_page
-
return render(request, "oj/contest/submissions_list.html",
{"submissions": current_page, "page": int(page),
"previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20,
From 4adb1c0b0ce3888e691083c74f7c34dbc060b72a Mon Sep 17 00:00:00 2001
From: virusdefender <1670873886@qq.com>
Date: Tue, 25 Aug 2015 10:57:09 +0800
Subject: [PATCH 16/16] =?UTF-8?q?=E6=95=B4=E7=90=86=E6=A0=BC=E5=BC=8F?=
=?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8F=90=E4=BA=A4=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../oj/contest/contest_problems_list.html | 7 +-
template/oj/contest/submissions_list.html | 148 +++++++++---------
utils/templatetags/user.py | 17 ++
3 files changed, 97 insertions(+), 75 deletions(-)
create mode 100644 utils/templatetags/user.py
diff --git a/template/oj/contest/contest_problems_list.html b/template/oj/contest/contest_problems_list.html
index 4dd68c5..2a863dd 100644
--- a/template/oj/contest/contest_problems_list.html
+++ b/template/oj/contest/contest_problems_list.html
@@ -41,10 +41,11 @@
{% for item in contest_problems %}
|
- {{ item.sort_index }}
+ |
+ {{ item.sort_index }}
|
- {{ item.title }}
+ |
+ {{ item.title }}
|
{{ item|accepted_radio }} |
diff --git a/template/oj/contest/submissions_list.html b/template/oj/contest/submissions_list.html
index 6635219..336e9c3 100644
--- a/template/oj/contest/submissions_list.html
+++ b/template/oj/contest/submissions_list.html
@@ -2,79 +2,83 @@
{% block body %}
-{% load submission %}
-
-
- {% if submissions %}
-
-
-
- | # |
- 提交时间 |
- 结果 |
- 运行时间 |
- 语言 |
-
-
-
- {% for item in submissions %}
-
+ {% load submission %}
+ {% load user %}
+
+
+ {% if submissions %}
+
+
+
+ | # |
+ 用户 |
+ 提交时间 |
+ 结果 |
+ 运行时间 |
+ 语言 |
+
+
+
+ {% for item in submissions %}
+
- {% ifequal item.user_id request.user.id %}
- |
- {{ forloop.counter |add:start_id }} |
- {% else %}
- {{ forloop.counter |add:start_id }} |
- {% endifequal %}
+ {% ifequal item.user_id request.user.id %}
+
+ {{ forloop.counter |add:start_id }} |
+ {% else %}
+ {{ forloop.counter |add:start_id }} |
+ {% endifequal %}
- {{ item.create_time }} |
- {{ item.result|translate_result }} |
-
- {% if item.accepted_answer_time %}
- {{ item.accepted_answer_time }}ms
- {% else %}
- --
+ | {{ item.user_id|get_username }} |
+
+ {{ item.create_time }} |
+ {{ item.result|translate_result }} |
+
+ {% if item.accepted_answer_time %}
+ {{ item.accepted_answer_time }}ms
+ {% else %}
+ --
+ {% endif %}
+ |
+
+ {{ item.language|translate_language }}
+ |
+
+ {% endfor %}
+
+
+
+ {% else %}
+ 你还没有提交记录!
+ {% endif %}
+
- {% endfor %}
-
-
-
- {% else %}
- 你还没有提交记录!
- {% endif %}
-
-
+ {% if next_page %}
+
+ 下一页 →
+ {% endif %}
+
+
+
{% endblock %}
diff --git a/utils/templatetags/user.py b/utils/templatetags/user.py
new file mode 100644
index 0000000..4a81de5
--- /dev/null
+++ b/utils/templatetags/user.py
@@ -0,0 +1,17 @@
+# coding=utf-8
+import datetime
+from account.models import User
+
+
+def get_username(user_id):
+ try:
+ return User.objects.get(id=user_id).username
+ except User.DoesNotExist:
+ return ""
+
+
+from django import template
+
+register = template.Library()
+register.filter("get_username", get_username)
+
| |