Compare commits
6 Commits
3a54e398e4
...
56288ddf45
| Author | SHA1 | Date |
|---|---|---|
|
|
56288ddf45 | 2 years ago |
|
|
aaf75caf3d | 2 years ago |
|
|
b1db98c238 | 2 years ago |
|
|
5ebd090507 | 2 years ago |
|
|
6555d026e1 | 2 years ago |
|
|
903ca3123c | 2 years ago |
@ -0,0 +1,13 @@ |
|||||||
|
|
||||||
|
# Rest Framework configuration |
||||||
|
REST_FRAMEWORK = { |
||||||
|
# Use Django's standard `django.contrib.auth` permissions, |
||||||
|
# or allow read-only access for unauthenticated users. |
||||||
|
# 'DEFAULT_PERMISSION_CLASSES': [ |
||||||
|
# 'rest_framework.permissions.IsAuthenticated', |
||||||
|
# ], |
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': [ |
||||||
|
'rest_framework.authentication.BasicAuthentication', |
||||||
|
'rest_framework.authentication.TokenAuthentication', |
||||||
|
] |
||||||
|
} |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
# Generated by Django 4.2.11 on 2024-03-08 11:09 |
||||||
|
|
||||||
|
import django.contrib.postgres.fields |
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('tournaments', '0010_alter_groupstage_tournament_alter_round_tournament'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AlterField( |
||||||
|
model_name='teamstate', |
||||||
|
name='score', |
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None), |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
# Generated by Django 4.2.11 on 2024-03-08 11:40 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('tournaments', '0011_alter_teamstate_score'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AlterField( |
||||||
|
model_name='teamstate', |
||||||
|
name='score', |
||||||
|
field=models.CharField(blank=True, max_length=50, null=True), |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
# Generated by Django 4.2.11 on 2024-03-08 13:38 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
import django.db.models.deletion |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('tournaments', '0012_alter_teamstate_score'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AddField( |
||||||
|
model_name='teamstate', |
||||||
|
name='team_registration', |
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='tournaments.match'), |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
# Generated by Django 4.2.11 on 2024-03-08 13:42 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
import django.db.models.deletion |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('tournaments', '0013_teamstate_team_registration'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AlterField( |
||||||
|
model_name='teamstate', |
||||||
|
name='team_registration', |
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='tournaments.teamregistration'), |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
<div class="bubble"> |
||||||
|
|
||||||
|
<div class="flex-row"> |
||||||
|
<label class="left-label matchtitle">{{ match.title }}</label> |
||||||
|
<label class="right-label info">{{ match.formatted_start_date }}</label> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
|
||||||
|
{% for team in match.teams %} |
||||||
|
<div class="test bottom-border padding-bottom-small"> |
||||||
|
<div class="left-label"> |
||||||
|
{% for name in team.names %} |
||||||
|
<div class="winner"> |
||||||
|
{{ name }} |
||||||
|
</div> |
||||||
|
{% endfor %} |
||||||
|
</div> |
||||||
|
<div class=""> |
||||||
|
{% for score in team.scores %} |
||||||
|
<span class="score ws {% if team.is_winner %}winner{% endif %}">{{ score }}</span> |
||||||
|
{% endfor %} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endfor %} |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="top-margin flex-row"> |
||||||
|
<label class="left-label minor-info">{{ match.duration }}</label> |
||||||
|
<!-- <a href="" class="right-label">détails</a> --> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
{% extends 'tournaments/base.html' %} |
||||||
|
|
||||||
|
{% block head_title %}Matchs{% endblock %} |
||||||
|
{% block title %}Matchs{% endblock %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
|
||||||
|
{% if matches %} |
||||||
|
|
||||||
|
<div class="grid-x"> |
||||||
|
<div class="cell medium-6 large-6 topblock my-block"> |
||||||
|
{% if matches %} |
||||||
|
|
||||||
|
{% for match in matches %} |
||||||
|
|
||||||
|
{% include 'tournaments/match_cell.html' %} |
||||||
|
|
||||||
|
{% endfor %} |
||||||
|
|
||||||
|
{% endif %} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% endblock %} |
||||||
@ -0,0 +1,142 @@ |
|||||||
|
{% load static %} |
||||||
|
|
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> |
||||||
|
<link rel="stylesheet" href="{% static 'tournaments/css/foundation.min.css' %}" /> |
||||||
|
<link rel="stylesheet" href="{% static 'tournaments/css/style.css' %}" /> |
||||||
|
|
||||||
|
<link rel="icon" type="image/png" href="{% static 'tournaments/images/favicon.png' %}" /> |
||||||
|
|
||||||
|
<title>Padel</title> |
||||||
|
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> |
||||||
|
|
||||||
|
</head> |
||||||
|
|
||||||
|
<!-- |
||||||
|
TODO: utiliser le nom de l'URL pour le fetch {% url "monurl" tournament.pk %}?format=json |
||||||
|
--> |
||||||
|
|
||||||
|
<body x-data="{ |
||||||
|
tournament: null, |
||||||
|
active: 1, |
||||||
|
screens: 2, |
||||||
|
retrieveTournament() { |
||||||
|
fetch('/api/exp-tournaments/{{ tournament.pk }}/?format=json') |
||||||
|
.then(res => res.json()) |
||||||
|
.then((data) => { |
||||||
|
this.tournament = data |
||||||
|
}) |
||||||
|
}, |
||||||
|
loop() { |
||||||
|
this.retrieveTournament() |
||||||
|
setInterval(() => { |
||||||
|
this.retrieveTournament() |
||||||
|
this.active = this.active === this.screens ? 1 : this.active+1 |
||||||
|
}, 3000) |
||||||
|
} |
||||||
|
}" x-init="loop()"> |
||||||
|
|
||||||
|
<div class="wrapper"> |
||||||
|
<main class="page-body"> |
||||||
|
<div class="container"> |
||||||
|
<div class="grid-x"> |
||||||
|
<div class="cell medium-6 large-6 topblock my-block"> |
||||||
|
<div class="bubble"> |
||||||
|
<img |
||||||
|
src="{% static 'tournaments/images/PadelClub_logo_512.png' %}" |
||||||
|
class="logo inline" |
||||||
|
/> |
||||||
|
<div class="inline"> |
||||||
|
<h1 class="club">4Padel Toulouse</h1> |
||||||
|
<h1 class="event">Planning</h1> |
||||||
|
<!-- <span>Propulsé par Padel Club</span> --> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<template x-if="tournament"> |
||||||
|
|
||||||
|
<div class="grid-x padding-bottom"> |
||||||
|
<div class="cell medium-6 large-6 topblock my-block"> |
||||||
|
|
||||||
|
<div class="bubble" x-show="active === 1"> |
||||||
|
<label class="title">Équipes</label> |
||||||
|
<template x-for="team in tournament.teamregistration_set" > |
||||||
|
<div class="table-container bottom-border vertical-padding"> |
||||||
|
<img src="{% static 'tournaments/images/pc_icon_round_200.png' %}" class="team_image horizontal-margin"> |
||||||
|
<div class="w50 tight table-cell hpadding10"> |
||||||
|
<template x-for="player in team.playerregistration_set"> |
||||||
|
<div> |
||||||
|
<div x-text="player.first_name"></div> <div x-text="player.last_name"></div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</div> |
||||||
|
<div class="table-cell horizontal-padding"> |
||||||
|
<span x-text="team.court"></span> |
||||||
|
</div> |
||||||
|
<div class="table-cell horizontal-padding large"> |
||||||
|
<span x-text="team.call_date"></span> |
||||||
|
</div> |
||||||
|
<div class="table-cell"><div class="mybox">Poule A</div></div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="bubble" x-show="active === 2"> |
||||||
|
<label class="title">Matchs</label> |
||||||
|
<template x-for="round in tournament.round_set"> |
||||||
|
<template x-for="match in round.match_set"> |
||||||
|
|
||||||
|
<div> |
||||||
|
|
||||||
|
<div class="flex-row"> |
||||||
|
<label class="left-label matchtitle">{{ match.id }}</label> |
||||||
|
<label class="right-label info">{{ match.start_date }}</label> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
|
||||||
|
{% for team in match.team_states %} |
||||||
|
<div class="test bottom-border padding-bottom-small"> |
||||||
|
<div class="left-label"> |
||||||
|
{% for name in team.names %} |
||||||
|
<div class="winner"> |
||||||
|
{{ name }} |
||||||
|
</div> |
||||||
|
{% endfor %} |
||||||
|
</div> |
||||||
|
<div class=""> |
||||||
|
{% for score in team.scores %} |
||||||
|
<span class="score ws {% if team.is_winner %}winner{% endif %}">{{ score }}</span> |
||||||
|
{% endfor %} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endfor %} |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="top-margin flex-row"> |
||||||
|
<label class="left-label minor-info">{{ match.duration }}</label> |
||||||
|
<!-- <a href="" class="right-label">détails</a> --> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
</template> |
||||||
|
</template> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</template> |
||||||
|
|
||||||
|
</div> |
||||||
|
</main> |
||||||
|
</div> |
||||||
|
|
||||||
|
</body> |
||||||
|
</html> |
||||||
@ -1,9 +1,19 @@ |
|||||||
from django.urls import path |
from django.urls import include, path |
||||||
|
|
||||||
from . import views |
from . import views |
||||||
|
|
||||||
urlpatterns = [ |
urlpatterns = [ |
||||||
|
|
||||||
path("", views.index, name="index"), |
path("", views.index, name="index"), |
||||||
path('tournament/<str:tournament_id>/', views.tournament, name='tournament'), |
|
||||||
path('tournament/<str:tournament_id>/planning/', views.tournament_planning, name='tournament-planning'), |
# Tournament |
||||||
|
path("tournament/<str:tournament_id>/", |
||||||
|
include( |
||||||
|
[ |
||||||
|
path("", views.tournament, name="tournament"), |
||||||
|
path("planning/", views.tournament_planning, name="tournament-planning"), |
||||||
|
path("stream/", views.tournament_stream, name="tournament-stream"), |
||||||
|
] |
||||||
|
) |
||||||
|
) |
||||||
] |
] |
||||||
|
|||||||
Loading…
Reference in new issue