删除排名页面的分页

This commit is contained in:
virusdefender
2016-01-06 17:12:14 +08:00
parent 8c5ee64db8
commit 4b87ffe4c5
2 changed files with 1 additions and 34 deletions

View File

@@ -451,25 +451,9 @@ def contest_rank_page(request, contest_id):
else: else:
rank = json.loads(rank) rank = json.loads(rank)
try:
paging_rank = paginate_data(request, rank, None)
if request.GET.get("paging", None):
rank = paging_rank["results"]
else:
rank = paging_rank
except Exception as e:
return error_page(request, e.message)
if request.GET.get("paging", None):
paging_info = paging_rank
paging_info["offset"] = paging_rank["page_size"] * (int(paging_rank["current_page"]) - 1)
else:
paging_info = {"previous_page": None, "next_page": None, "count": 0, "total_page": 0, "offset": 0}
return render(request, "oj/contest/contest_rank.html", return render(request, "oj/contest/contest_rank.html",
{"rank": rank, "contest": contest, {"rank": rank, "contest": contest,
"contest_problems": contest_problems, "contest_problems": contest_problems,
"paging_info": paging_info,
"auto_refresh": request.GET.get("auto_refresh", None) == "true", "auto_refresh": request.GET.get("auto_refresh", None) == "true",
"show_real_name": request.GET.get("show_real_name", None) == "true", }) "show_real_name": request.GET.get("show_real_name", None) == "true", })

View File

@@ -17,7 +17,7 @@
<a href="/contest/{{ contest.id }}/submissions/">提交</a> <a href="/contest/{{ contest.id }}/submissions/">提交</a>
</li> </li>
<li role="presentation" class="active"> <li role="presentation" class="active">
<a href="/contest/{{ contest.id }}/rank/?paging=true&page=1&page_size=40">排名</a> <a href="/contest/{{ contest.id }}/rank/">排名</a>
</li> </li>
</ul> </ul>
@@ -73,23 +73,6 @@
<input type="checkbox" id="auto-refresh" {% if auto_refresh %}checked{% endif %} <input type="checkbox" id="auto-refresh" {% if auto_refresh %}checked{% endif %}
onchange="if(this.checked){location.href=location.href + '&auto_refresh=true'}else{location.href=location.href=location.href.replace('&auto_refresh=true', '')}"> onchange="if(this.checked){location.href=location.href + '&auto_refresh=true'}else{location.href=location.href=location.href.replace('&auto_refresh=true', '')}">
自动刷新 自动刷新
<nav>
<ul class="pager">
{% if paging_info.previous_page %}
<li class="previous">
<a href="/contest/{{ contest.id }}/rank/?paging=true&page={{ paging_info.previous_page }}&page_size={{ paging_info.page_size }}{% if auto_refresh %}&auto_refresh=true{% endif %}">
<span aria-hidden="true">&larr;</span> 上一页
</a></li>
{% endif %}
{% if paging_info.next_page %}
<li class="next">
<a href="/contest/{{ contest.id }}/rank/?paging=true&page={{ paging_info.next_page }}&page_size={{ paging_info.page_size }}{% if auto_refresh %}&auto_refresh=true{% endif %}">
下一页 <span aria-hidden="true">&rarr;</span>
</a></li>
{% endif %}
</ul>
</nav>
{% else %} {% else %}
<p>还没有结果</p> <p>还没有结果</p>
<input type="checkbox" id="auto-refresh" {% if auto_refresh %}checked{% endif %} <input type="checkbox" id="auto-refresh" {% if auto_refresh %}checked{% endif %}