Compare commits
8 Commits
3c013794d7
...
dfa36b58a6
Author | SHA1 | Date |
---|---|---|
Danhia | dfa36b58a6 | |
Starthur | bf5678d371 | |
Danhia | 6110408cd0 | |
Starthur | bb2617a3e4 | |
Starthur | e23d6d7f49 | |
Starthur | 978dd24a00 | |
Starthur | 3991dda7d3 | |
Starthur | e8575d559e |
|
@ -12,6 +12,7 @@
|
|||
<th scope="col">{% trans "Rank" %}</th>
|
||||
<th scope="col">{% trans "Username" %}</th>
|
||||
<th scope="col">{% trans "Website" %}</th>
|
||||
<th scope="col">{% trans "Campus" %}</th>
|
||||
<th scope="col">{% trans "Score" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -26,6 +27,13 @@
|
|||
<a href="{{ s.user.userprofileinfo.portfolio_site }}" target="_blank">{{ s.user.userprofileinfo.portfolio_site }}</a>
|
||||
{% 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 }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ s.user.userprofileinfo.score }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -4,5 +4,6 @@ from . import views
|
|||
app_name = "scoreboard"
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.scoreboard, name='scoreboard')
|
||||
path('', views.scoreboard, name='scoreboard'),
|
||||
path('campus/<str:campus>', views.campus, name='campus')
|
||||
]
|
||||
|
|
|
@ -8,5 +8,12 @@ def scoreboard(request):
|
|||
page = request.GET.get('page')
|
||||
scores_p = paginator.get_page(page)
|
||||
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')
|
||||
paginator = Paginator(scores, 20)
|
||||
page = request.GET.get('page')
|
||||
scores_p = paginator.get_page(page)
|
||||
return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p})
|
||||
|
||||
# Create your views here.
|
||||
|
|
Loading…
Reference in New Issue