Check FK to print value in scoreboard

This commit is contained in:
Starthur 2022-08-01 22:15:42 +02:00
parent 42858e4342
commit c449f26ad7
Signed by: Starthur
GPG Key ID: 68AD34A2CF658E32
2 changed files with 8 additions and 8 deletions

View File

@ -28,9 +28,9 @@
{% endif %}
</td>
<td>
{% if s.user.userprofileinfo.intra42_campus %}
<a href="{% url 'scoreboard:campus' campus=s.user.userprofileinfo.intra42_campus %}">
{{ s.user.userprofileinfo.intra42_campus }}
{% if s.user.userprofileinfo.campus %}
<a href="{% url 'scoreboard:campus' campus=s.user.userprofileinfo.campus %}">
{{ s.user.userprofileinfo.campus }}
</a>
{% endif %}
</td>

View File

@ -10,7 +10,7 @@ def scoreboard(request):
return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p})
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)
page = request.GET.get('page')
scores_p = paginator.get_page(page)