From fa874a0143f47fa855c25a6500580b90c7c765d7 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Sun, 30 Jul 2023 00:25:49 +0200 Subject: [PATCH] update htmls --- scores/templates/scores/club.html | 6 +++++- scores/templates/scores/teams.html | 12 ++++++++++-- scores/templates/scores/tournament.html | 24 ++++++++++-------------- scores/urls.py | 4 ++-- scores/views.py | 12 ++++++++++++ 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/scores/templates/scores/club.html b/scores/templates/scores/club.html index 2100a59..98adb3a 100644 --- a/scores/templates/scores/club.html +++ b/scores/templates/scores/club.html @@ -22,7 +22,11 @@
{% endfor %} diff --git a/scores/templates/scores/teams.html b/scores/templates/scores/teams.html index 9b4ec02..7cc0247 100644 --- a/scores/templates/scores/teams.html +++ b/scores/templates/scores/teams.html @@ -54,13 +54,21 @@ {% endif %} {% if tournament.club.header %} -
{{ tournament.club.header }}
+ {% if tv %} +
{{ tournament.club.header }}
+ {% else %} +
{{ tournament.club.header }}
+ {% endif %} {% endif %}
{% autoescape off %}
-

{{ tournament.name }} + {% if tv %} +

{{ tournament.name }} + {% else %} +

{{ tournament.name }} + {% endif %}

diff --git a/scores/templates/scores/tournament.html b/scores/templates/scores/tournament.html index 187ba13..766d67a 100644 --- a/scores/templates/scores/tournament.html +++ b/scores/templates/scores/tournament.html @@ -60,14 +60,18 @@

{{ tournament.name }}

-

{{ tournament.club.name }} | Équipes

-

+ {% if tv %} +

{{ tournament.club.name }} | Équipes

+ {% else %} +

{{ tournament.club.name }} | Équipes

+ {% endif %} +

{% for match in live_matches %}
-

{{ match.title }}

+

{{ match.title|default:"Match" }}

{% if match.isMatch or match.isBracket %} {% if match.isMatch %} @@ -84,10 +88,6 @@

STATISTIQUES

- {% else %} -
-

#{{ match.court }}

-

{% endif %} {% endif %} @@ -145,7 +145,7 @@ {% endif %} - {% if match.isMatch or match.isBracket %} + {% if not match.isStatistic %}

{{ match.durationPrefix }}
{{ match.duration }}
@@ -160,7 +160,7 @@
-

{{ match.title }}

+

{{ match.title|default:"Match" }}

{% if match.isMatch or match.isBracket %} {% if match.isMatch %} @@ -177,10 +177,6 @@ - {% else %} - {% endif %} {% endif %} @@ -238,7 +234,7 @@ {% endif %} - {% if match.isMatch or match.isBracket %} + {% if not match.isStatistic %}

{{ match.durationPrefix }}
{{ match.duration }}
diff --git a/scores/urls.py b/scores/urls.py index ae91a29..131d18c 100644 --- a/scores/urls.py +++ b/scores/urls.py @@ -22,13 +22,13 @@ urlpatterns = [ path('match//', views.match, name='match'), path('tv/match//', views.match_tv, name='match'), - path('tv/club///equipes/', views.tv_teams_club_name_tournament, name='teams'), + path('tv/club//tournoi//equipes/', views.tv_teams_club_name_tournament, name='teams'), path('tv/tournoi//equipes/', views.tv_teams_tournament_name, name='teams'), path('tv/club///equipes/', views.tv_teams_club_name_tournament_name, name='teams'), path('tv/', views.index, name='index'), path('tv/tournoi//', views.tv_tournament_name, name='tournament'), - path('tv/club//', views.club_name, name='club'), + path('tv/club//', views.tv_club_name, name='club'), path('tv/club//tournoi//', views.tv_club_name_tournament, name='tournament'), path('tv/club///', views.tv_club_name_tournament_name, name='tournament'), diff --git a/scores/views.py b/scores/views.py index a239813..3bb0859 100644 --- a/scores/views.py +++ b/scores/views.py @@ -41,6 +41,18 @@ def club_name(request, club_name): } return HttpResponse(template.render(context, request)) +def tv_club_name(request, club_name): + + club = get_object_or_404(Club, name__iexact=club_name.lower()) + tournaments = Tournament.objects.filter(club=club.id) + template = loader.get_template('scores/club.html') + context = { + 'club': club, + 'tournaments': tournaments, + 'tv': True, + } + return HttpResponse(template.render(context, request)) + def tournament_name(request, tournament_shortname): tournamentFound = Tournament.objects.filter(shortname__iexact=tournament_shortname.lower()).first() return tournament(request, tournamentFound.id)