From b737a2dd9de5d691359e384dc8a19989531b862a Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 15 Jun 2024 10:49:35 +0200 Subject: [PATCH] Improve see all links --- .../templates/tournaments/tournaments.html | 18 ++++++++++++++++++ tournaments/views.py | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tournaments/templates/tournaments/tournaments.html b/tournaments/templates/tournaments/tournaments.html index 10ca204..5c1facf 100644 --- a/tournaments/templates/tournaments/tournaments.html +++ b/tournaments/templates/tournaments/tournaments.html @@ -23,9 +23,15 @@ {% include 'tournaments/tournament_row.html' %} {% endfor %} + {% if live|length > 10 %}
+ {% if club %} + Voir tous... + {% else %} Voir tous... + {% endif %}
+ {% endif %} {% endif %} @@ -37,9 +43,15 @@ {% include 'tournaments/tournament_row.html' %} {% endfor %} + {% if future|length > 10 %}
+ {% if club %} + Voir tous... + {% else %} Voir tous... + {% endif %}
+ {% endif %} {% endif %} @@ -58,9 +70,15 @@ {% include 'tournaments/tournament_row.html' %} {% endfor %} + {% if ended|length > 10 %}
+ {% if club %} + Voir tous... + {% else %} Voir tous... + {% endif %}
+ {% endif %} diff --git a/tournaments/views.py b/tournaments/views.py index b71c44d..1a25bb4 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -26,6 +26,10 @@ def index(request): live = live_tournaments(club_id) finished = finished_tournaments(club_id) + club = None + if club_id: + club = get_object_or_404(Club, pk=club_id) + return render( request, "tournaments/tournaments.html", @@ -87,7 +91,7 @@ def tournaments(request): { 'tournaments': tournaments, 'title': title, - 'club': club, + 'club': club_id, } )