fix-campus-in-scoreboard #65

Merged
Danhia merged 2 commits from fix-campus-in-scoreboard into main 2022-08-01 22:21:45 +02:00
2 changed files with 8 additions and 8 deletions
Showing only changes of commit c449f26ad7 - Show all commits

View File

@ -28,9 +28,9 @@
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if s.user.userprofileinfo.intra42_campus %} {% if s.user.userprofileinfo.campus %}
<a href="{% url 'scoreboard:campus' campus=s.user.userprofileinfo.intra42_campus %}"> <a href="{% url 'scoreboard:campus' campus=s.user.userprofileinfo.campus %}">
{{ s.user.userprofileinfo.intra42_campus }} {{ s.user.userprofileinfo.campus }}
</a> </a>
{% endif %} {% endif %}
</td> </td>
@ -39,25 +39,25 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="pagination"> <div class="pagination">
<span class="step-links"> <span class="step-links">
{% if scores.has_previous %} {% if scores.has_previous %}
<a href="?page=1">&laquo; {% trans "First" %}</a> <a href="?page=1">&laquo; {% trans "First" %}</a>
<a href="?page={{ scores.previous_page_number }}">{% trans "Previous" %}</a> <a href="?page={{ scores.previous_page_number }}">{% trans "Previous" %}</a>
{% endif %} {% endif %}
<span class="current"> <span class="current">
{% trans "Page "%} {{ scores.number }} / {{ scores.paginator.num_pages }}. {% trans "Page "%} {{ scores.number }} / {{ scores.paginator.num_pages }}.
</span> </span>
{% if scores.has_next %} {% if scores.has_next %}
<a href="?page={{ scores.next_page_number }}">{% trans "Next" %}</a> <a href="?page={{ scores.next_page_number }}">{% trans "Next" %}</a>
<a href="?page={{ scores.paginator.num_pages }}">{% trans "Last" %}&raquo;</a> <a href="?page={{ scores.paginator.num_pages }}">{% trans "Last" %}&raquo;</a>
{% endif %} {% endif %}
</span> </span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -10,7 +10,7 @@ def scoreboard(request):
return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p}) return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p})
def campus(request, campus): def campus(request, campus):
scores = UserProfileInfo.objects.filter(score__gt=0, intra42_campus__exact=campus).select_related().order_by('-score', 'last_submission_date', 'user__username') scores = UserProfileInfo.objects.filter(score__gt=0, campus__name__exact=campus).select_related().order_by('-score', 'last_submission_date', 'user__username')
paginator = Paginator(scores, 20) paginator = Paginator(scores, 20)
page = request.GET.get('page') page = request.GET.get('page')
scores_p = paginator.get_page(page) scores_p = paginator.get_page(page)