Adds clubs and club pages

clubs
Laurent 2 years ago
parent 4c9213ce23
commit ea7be53272
  1. 2
      tournaments/templates/tournaments/base.html
  2. 12
      tournaments/templates/tournaments/club_row.html
  3. 32
      tournaments/templates/tournaments/clubs.html
  4. 2
      tournaments/templates/tournaments/group_stages.html
  5. 2
      tournaments/templates/tournaments/matches.html
  6. 5
      tournaments/templates/tournaments/navigation_base.html
  7. 0
      tournaments/templates/tournaments/navigation_tournament.html
  8. 2
      tournaments/templates/tournaments/summons.html
  9. 4
      tournaments/templates/tournaments/tournament_row.html
  10. 9
      tournaments/templates/tournaments/tournaments.html
  11. 2
      tournaments/urls.py
  12. 39
      tournaments/views.py

@ -23,7 +23,7 @@
<body class="wrapper">
<header>
<div class="grid-x">
<div class="cell large-6 topblock my-block">
<div class="cell topblock my-block">
<!-- <div class="bubble"> -->
<a href="{% url 'index' %}">
<img

@ -0,0 +1,12 @@
{% load static %}
<div class="table-row-4-colums bottom-border">
<div class="table-cell table-cell-large semibold">
<a href="{% url 'index' %}?club={{ club.id }}">{{ club.name }}</a>
</div>
<!-- <div class="table-cell center">{{ summon.weight }}</div>
<div class="table-cell large center">{{ summon.date|date:'H:i' }}</div>
<div class="table-cell"><div class="mybox center">{{ summon.stage }}</div></div> -->
</div>

@ -0,0 +1,32 @@
{% extends 'tournaments/base.html' %}
{% block head_title %}Clubs{% endblock %}
{% block first_title %}Padel Club{% endblock %}
{% block second_title %}Clubs{% endblock %}
{% load static %}
{% block content %}
{% include 'tournaments/navigation_base.html' %}
{% if clubs %}
<div class="grid-x padding-bottom">
<div class="cell medium-6 large-6 my-block">
<div class="bubble">
{% for club in clubs %}
{% include 'tournaments/club_row.html' %}
{% endfor %}
</div>
</div>
</div>
{% endif %}
{% endblock %}

@ -6,7 +6,7 @@
{% block content %}
{% include 'tournaments/tournament_navigation.html' %}
{% include 'tournaments/navigation_tournament.html' %}
<div class="grid-x">
{% for group_stage in group_stages %}

@ -6,7 +6,7 @@
{% block content %}
{% include 'tournaments/tournament_navigation.html' %}
{% include 'tournaments/navigation_tournament.html' %}
{% if rounds or group_stages %}
<nav class="margin10">

@ -0,0 +1,5 @@
<nav class="margin10">
<a href="{% url 'index' %}" class="mybox">Accueil</a>
<a href="{% url 'clubs' %}" class="mybox">Clubs</a>
</nav>

@ -8,7 +8,7 @@
{% load static %}
{% include 'tournaments/tournament_navigation.html' %}
{% include 'tournaments/navigation_tournament.html' %}
{% if team_summons %}

@ -6,8 +6,12 @@
<div class="small">{{ tournament.category }}</div>
</div>
<div class="table-cell table-cell-large horizontal-padding semibold">
{% if club %}
<span>{{ tournament.name }}</span>
{% else %}
<span>{{ tournament.event.club.name }}: </span>
<span>{{ tournament.name }}</span>
{% endif %}
</div>
<div class="table-cell"><div class="mybox">{{ tournament.formatted_start_date }}</div></div>
</div>

@ -2,10 +2,17 @@
{% block head_title %}Tournois{% endblock %}
{% block first_title %}Padel Club{% endblock %}
{% block second_title %}Tournois{% endblock %}
{% block second_title %}
{% if club %}
{{ club.name }}
{% else %}
Tournois
{% endif %}
{% endblock %}
{% block content %}
{% include 'tournaments/navigation_base.html' %}
{% if live or future %}

@ -4,6 +4,8 @@ from . import views
urlpatterns = [
path("", views.index, name="index"),
path("clubs/", views.clubs, name="clubs"),
path("clubs/<str:club_id>/", views.club, name="club"),
path("tournament/<str:tournament_id>/",
include([
path('', views.tournament, name='tournament'),

@ -17,13 +17,32 @@ from rest_framework.generics import UpdateAPIView
from django.template import loader
from datetime import date
from django.http import JsonResponse
from django.db.models import Q
import json
def index(request):
today = date.today()
future_tournaments = Tournament.objects.filter(is_private=False, end_date__isnull=True, start_date__gt=today).order_by('start_date')
live_tournaments = Tournament.objects.filter(is_private=False, end_date__isnull=True, start_date__lte=today).order_by('start_date')
ended_tournaments = Tournament.objects.filter(is_private=False, end_date__isnull=False).order_by('start_date')
club_id = request.GET.get('club')
q_is_private = Q(is_private=False)
q_future = [q_is_private, Q(end_date__isnull=True, start_date__gt=today)]
q_live = [q_is_private, Q(end_date__isnull=True, start_date__lte=today)]
q_ended = [q_is_private, Q(end_date__isnull=False)]
club = None
if club_id:
club = get_object_or_404(Club, pk=club_id)
q_club = Q(event__club=club)
q_future.append(q_club)
q_live.append(q_club)
q_ended.append(q_club)
future_tournaments = Tournament.objects.filter(*q_future).order_by('start_date')
live_tournaments = Tournament.objects.filter(*q_live).order_by('start_date')
ended_tournaments = Tournament.objects.filter(*q_ended).order_by('start_date')
return render(
request,
"tournaments/tournaments.html",
@ -31,9 +50,23 @@ def index(request):
'future': future_tournaments,
'live': live_tournaments,
'ended': ended_tournaments,
'club': club,
}
)
def clubs(request):
clubs = Club.objects.all().order_by('name')
return render(request, 'tournaments/clubs.html', {
'clubs': clubs,
})
def club(request, club_id):
club = get_object_or_404(Club, pk=club_id)
return render(request, 'tournaments/summons.html', {
'tournament': tournament,
'team_summons': team_summons,
})
def tournament(request, tournament_id):
tournament = get_object_or_404(Tournament, pk=tournament_id)

Loading…
Cancel
Save