Compare commits

..

No commits in common. "dfa36b58a62898ecff6f2c068b7a13dda51a50a9" and "3c013794d7323187aaaa763e6b4f6109e8618fa4" have entirely different histories.

3 changed files with 2 additions and 18 deletions

View File

@ -12,7 +12,6 @@
<th scope="col">{% trans "Rank" %}</th> <th scope="col">{% trans "Rank" %}</th>
<th scope="col">{% trans "Username" %}</th> <th scope="col">{% trans "Username" %}</th>
<th scope="col">{% trans "Website" %}</th> <th scope="col">{% trans "Website" %}</th>
<th scope="col">{% trans "Campus" %}</th>
<th scope="col">{% trans "Score" %}</th> <th scope="col">{% trans "Score" %}</th>
</tr> </tr>
</thead> </thead>
@ -27,13 +26,6 @@
<a href="{{ s.user.userprofileinfo.portfolio_site }}" target="_blank">{{ s.user.userprofileinfo.portfolio_site }}</a> <a href="{{ s.user.userprofileinfo.portfolio_site }}" target="_blank">{{ s.user.userprofileinfo.portfolio_site }}</a>
{% endif %} {% endif %}
</td> </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> <td>{{ s.user.userprofileinfo.score }}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -4,6 +4,5 @@ from . import views
app_name = "scoreboard" app_name = "scoreboard"
urlpatterns = [ urlpatterns = [
path('', views.scoreboard, name='scoreboard'), path('', views.scoreboard, name='scoreboard')
path('campus/<str:campus>', views.campus, name='campus')
] ]

View File

@ -8,12 +8,5 @@ def scoreboard(request):
page = request.GET.get('page') page = request.GET.get('page')
scores_p = paginator.get_page(page) scores_p = paginator.get_page(page)
return render(request, 'scoreboard/scoreboard.html', {'scores':scores_p}) 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. # Create your views here.