整理格式,增加提交列表的用户名
This commit is contained in:
@@ -41,10 +41,11 @@
|
||||
{% for item in contest_problems %}
|
||||
<tr>
|
||||
<th><span class="glyphicon glyphicon-ok ac-flag"></span></th>
|
||||
<th scope="row"><a
|
||||
href="/contest/{{ item.contest.id }}/problem/{{ item.id }}/">{{ item.sort_index }}</a>
|
||||
<th scope="row">
|
||||
<a href="/contest/{{ item.contest.id }}/problem/{{ item.id }}/" target="_blank">{{ item.sort_index }}</a>
|
||||
</th>
|
||||
<td><a href="/contest/{{ item.contest.id }}/problem/{{ item.id }}/">{{ item.title }}</a>
|
||||
<td>
|
||||
<a href="/contest/{{ item.contest.id }}/problem/{{ item.id }}/" target="_blank">{{ item.title }}</a>
|
||||
</td>
|
||||
<td>{{ item|accepted_radio }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
{% block body %}
|
||||
|
||||
{% load submission %}
|
||||
<div class="container main">
|
||||
{% load submission %}
|
||||
{% load user %}
|
||||
<div class="container main">
|
||||
<div class="contest-tab">
|
||||
<ul class="nav nav-tabs nav-tabs-google">
|
||||
<li role="presentation">
|
||||
@@ -25,6 +26,7 @@
|
||||
<thead>
|
||||
<tr class="" success>
|
||||
<th>#</th>
|
||||
<td>用户</td>
|
||||
<th>提交时间</th>
|
||||
<th>结果</th>
|
||||
<th>运行时间</th>
|
||||
@@ -42,6 +44,8 @@
|
||||
<th scope="row">{{ forloop.counter |add:start_id }}</th>
|
||||
{% endifequal %}
|
||||
|
||||
<td>{{ item.user_id|get_username }}</td>
|
||||
|
||||
<td>{{ item.create_time }}</td>
|
||||
<td>{{ item.result|translate_result }}</td>
|
||||
<td>
|
||||
@@ -76,5 +80,5 @@
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
17
utils/templatetags/user.py
Normal file
17
utils/templatetags/user.py
Normal file
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user