From 8a50d5837f9e2b7fd0c7cbdb12d423fa42d8f107 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 4 Jun 2024 16:31:12 +0200 Subject: [PATCH] Adds broadcast page for club --- tournaments/static/tournaments/css/style.css | 9 ++++ .../templates/tournaments/broadcast_base.html | 2 + .../templates/tournaments/broadcast_club.html | 45 +++++++++++++++++++ tournaments/views.py | 12 ++++- 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tournaments/templates/tournaments/broadcast_club.html diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index 91c9baf..71e073c 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -587,6 +587,14 @@ h-margin { padding: 5px 0px; } +.table-row-4-colums-club-tournament { + display: grid; + grid-template-columns: 100px 60px 1fr auto; + align-items: center; + /* Vertically center the content within each column */ + padding: 5px 0px; +} + .table-row-4-colums { display: grid; grid-template-columns: 1px auto 50px 70px 100px; @@ -596,6 +604,7 @@ h-margin { padding: 5px 0px; } + .table-row-3-colums-teams { display: grid; grid-template-columns: 1px auto auto 80px; diff --git a/tournaments/templates/tournaments/broadcast_base.html b/tournaments/templates/tournaments/broadcast_base.html index e3f1d5f..b98296f 100644 --- a/tournaments/templates/tournaments/broadcast_base.html +++ b/tournaments/templates/tournaments/broadcast_base.html @@ -23,7 +23,9 @@

{% block second_title %}Page Title{% endblock %}

+ {% if qr_code_options %}
{% qr_from_text qr_code_url options=qr_code_options %}
+ {% endif %} diff --git a/tournaments/templates/tournaments/broadcast_club.html b/tournaments/templates/tournaments/broadcast_club.html new file mode 100644 index 0000000..867b90a --- /dev/null +++ b/tournaments/templates/tournaments/broadcast_club.html @@ -0,0 +1,45 @@ +{% extends 'tournaments/broadcast_base.html' %} + +{% load static %} + +{% block head_title %}Broadcast{% endblock %} +{% block first_title %}{{ club.name }}{% endblock %} +{% block second_title %}Broadcast{% endblock %} + +{% block content %} +
+
+
+ + {% for tournament in tournaments %} + +
+
{{ tournament.formatted_start_date }}
+ +
+
{{ tournament.level }}
+
{{ tournament.category }}
+
+
+
{{ tournament.event.club.name }}
+ {% if tournament.name_and_event %} +
+ {{ tournament.name_and_event }} +
+ {% endif %} +
+ + +
+ + {% endfor %} +
+
+
+ +{% endblock %} diff --git a/tournaments/views.py b/tournaments/views.py index fcb7c75..9a8fc9f 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -24,7 +24,7 @@ def index(request): tomorrow = date.today() + timedelta(days=1) club_id = request.GET.get('club') - q_base = Q(is_private=False,is_deleted=False) + q_base = Q(is_private=False, is_deleted=False) q_after_tomorrow = [q_base, Q(end_date__isnull=True, start_date__gt=tomorrow)] q_unfinished = [q_base, Q(end_date__isnull=True)] @@ -233,4 +233,12 @@ def activate(request, uidb64, token): def club_broadcast(request, broadcast_code): club = get_object_or_404(Club, broadcast_code=broadcast_code) - return HttpResponse(club.name) + q_not_deleted = Q(is_deleted=False, event__club=club) + tournaments = Tournament.objects.filter(q_not_deleted).order_by('-start_date') + + print(len(tournaments)) + + return render(request, 'tournaments/broadcast_club.html', { + 'club': club, + 'tournaments': tournaments, + })