mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-09-21 00:13:18 +00:00
[前台]添加提交列表的公告栏
This commit is contained in:
parent
e14eaada4f
commit
4847a3a36c
@ -12,15 +12,14 @@ from judge.judger_controller.settings import redis_config
|
|||||||
from account.decorators import login_required
|
from account.decorators import login_required
|
||||||
from account.models import SUPER_ADMIN
|
from account.models import SUPER_ADMIN
|
||||||
|
|
||||||
from contest.decorators import check_user_contest_permission
|
|
||||||
|
|
||||||
from problem.models import Problem
|
from problem.models import Problem
|
||||||
from contest.models import Contest, ContestProblem
|
from contest.models import ContestProblem
|
||||||
|
|
||||||
from utils.shortcuts import serializer_invalid_response, error_response, success_response, error_page, paginate
|
from utils.shortcuts import serializer_invalid_response, error_response, success_response, error_page, paginate
|
||||||
from .models import Submission
|
from .models import Submission
|
||||||
from .serializers import CreateSubmissionSerializer, SubmissionSerializer
|
from .serializers import CreateSubmissionSerializer, SubmissionSerializer
|
||||||
|
from announcement.models import Announcement
|
||||||
|
|
||||||
class SubmissionAPIView(APIView):
|
class SubmissionAPIView(APIView):
|
||||||
@login_required
|
@login_required
|
||||||
@ -80,8 +79,10 @@ def problem_my_submissions_list_page(request, problem_id):
|
|||||||
problem = Problem.objects.get(id=problem_id, visible=True)
|
problem = Problem.objects.get(id=problem_id, visible=True)
|
||||||
except Problem.DoesNotExist:
|
except Problem.DoesNotExist:
|
||||||
return error_page(request, u"问题不存在")
|
return error_page(request, u"问题不存在")
|
||||||
|
|
||||||
submissions = Submission.objects.filter(user_id=request.user.id, problem_id=problem.id, contest_id__isnull=True).order_by("-create_time"). \
|
submissions = Submission.objects.filter(user_id=request.user.id, problem_id=problem.id, contest_id__isnull=True).order_by("-create_time"). \
|
||||||
values("id", "result", "create_time", "accepted_answer_time", "language")
|
values("id", "result", "create_time", "accepted_answer_time", "language")
|
||||||
|
|
||||||
return render(request, "oj/problem/my_submissions_list.html",
|
return render(request, "oj/problem/my_submissions_list.html",
|
||||||
{"submissions": submissions, "problem": problem})
|
{"submissions": submissions, "problem": problem})
|
||||||
|
|
||||||
@ -154,6 +155,10 @@ def my_submission_list_page(request, page=1):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# 右侧的公告列表
|
||||||
|
announcements = Announcement.objects.filter(is_global=True, visible=True).order_by("-create_time")
|
||||||
|
|
||||||
return render(request, "oj/submission/my_submissions_list.html",
|
return render(request, "oj/submission/my_submissions_list.html",
|
||||||
{"submissions": current_page, "page": int(page),
|
{"submissions": current_page, "page": int(page),
|
||||||
"previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20})
|
"previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20,
|
||||||
|
"announcements": announcements})
|
@ -2,57 +2,62 @@
|
|||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
{% load submission %}
|
{% load submission %}
|
||||||
<div class="container main">
|
<div class="container main">
|
||||||
|
<div class="col-md-9 col-lg-9">
|
||||||
{% if submissions %}
|
{% if submissions %}
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="" success>
|
<tr class="" success>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>提交时间</th>
|
<th>提交时间</th>
|
||||||
<th>结果</th>
|
<th>结果</th>
|
||||||
<th>运行时间</th>
|
<th>运行时间</th>
|
||||||
<th>语言</th>
|
<th>语言</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for item in submissions %}
|
{% for item in submissions %}
|
||||||
<tr class="{{ item.result|translate_result_class }}">
|
<tr class="{{ item.result|translate_result_class }}">
|
||||||
<th scope="row"><a href="/my_submission/{{ item.id }}/" id="id_{{ forloop.counter }}">
|
<th scope="row"><a href="/my_submission/{{ item.id }}/" id="id_{{ forloop.counter }}">
|
||||||
{{ forloop.counter |add:start_id }}</a></th>
|
{{ forloop.counter |add:start_id }}</a></th>
|
||||||
<td>{{ item.create_time }}</td>
|
<td>{{ item.create_time }}</td>
|
||||||
<td>{{ item.result|translate_result }}</td>
|
<td>{{ item.result|translate_result }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if item.accepted_answer_time %}
|
{% if item.accepted_answer_time %}
|
||||||
{{ item.accepted_answer_time }}ms
|
{{ item.accepted_answer_time }}ms
|
||||||
{% else %}
|
{% else %}
|
||||||
--
|
--
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ item.language|translate_language }}
|
{{ item.language|translate_language }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
|
||||||
<p>你还没有提交记录!</p>
|
|
||||||
{% endif %}
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul class="pager">
|
<ul class="pager">
|
||||||
{% if previous_page %}
|
{% if previous_page %}
|
||||||
<li class="previous"><a
|
<li class="previous"><a
|
||||||
href="/submissions/{{ previous_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">
|
href="/submissions/{{ previous_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">
|
||||||
<span aria-hidden="true">←</span> 上一页</a></li>
|
<span aria-hidden="true">←</span> 上一页</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if next_page %}
|
{% if next_page %}
|
||||||
<li class="next"><a
|
<li class="next"><a
|
||||||
href="/submissions/{{ next_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">下一页 <span
|
href="/submissions/{{ next_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">下一页 <span
|
||||||
aria-hidden="true">→</span></a></li>
|
aria-hidden="true">→</span></a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
{% else %}
|
||||||
|
<p>你还没有提交记录!</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-3 col-lg-3">
|
||||||
|
{% include "oj/announcement/_announcement_panel.html" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user