diff --git a/tournaments/models/enums.py b/tournaments/models/enums.py
index 84950a1..cd763bc 100644
--- a/tournaments/models/enums.py
+++ b/tournaments/models/enums.py
@@ -340,3 +340,4 @@ class AnimationType(models.IntegerChoices):
MELEE = 1, 'Mêlée'
LOSER_BRACKET = 2, 'Classement'
CONSOLATION_BRACKET = 3, 'Consolation'
+ CUSTOM = 4, 'Custom'
diff --git a/tournaments/models/player_registration.py b/tournaments/models/player_registration.py
index 0c4000c..e9d8a83 100644
--- a/tournaments/models/player_registration.py
+++ b/tournaments/models/player_registration.py
@@ -135,10 +135,15 @@ class PlayerRegistration(TournamentSubModel):
tournament = self.team_registration.tournament
tournament_status_team_count = tournament.get_tournament_status_team_count()
+ # If custom animation type, replace header by "Inscriptions"
+ if tournament.is_custom_animation():
+ header = "Inscriptions"
+ else:
+ header = "Équipes"
if tournament.is_canceled():
return {
- 'header': "Équipes",
+ 'header': header,
'position': tournament_status_team_count,
'display_box': True,
'box_class': 'light-red',
@@ -146,7 +151,7 @@ class PlayerRegistration(TournamentSubModel):
}
status = {
- 'header': "Équipes",
+ 'header': header,
'position': tournament_status_team_count,
'display_box': True,
'box_class': 'gray',
diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py
index f94885f..71993d7 100644
--- a/tournaments/models/tournament.py
+++ b/tournaments/models/tournament.py
@@ -210,9 +210,24 @@ class Tournament(BaseModel):
def level(self):
return self.get_federal_level_category_display()
+ def is_custom_animation(self):
+ return self.animation_type == AnimationType.CUSTOM
+
def short_level(self):
if self.federal_level_category == 0:
- return "Anim."
+ match self.animation_type:
+ case AnimationType.TOURNAMENT:
+ return "Anim."
+ case AnimationType.MELEE:
+ return "Mêlée"
+ case AnimationType.LOSER_BRACKET:
+ return "Classement"
+ case AnimationType.CONSOLATION_BRACKET:
+ return "Consolante"
+ case AnimationType.CUSTOM:
+ return "Spécial"
+ case _:
+ return "Anim."
if self.federal_level_category == 1:
return "CHPT"
return self.get_federal_level_category_display()
diff --git a/tournaments/services/email_service.py b/tournaments/services/email_service.py
index 9aeafe9..8b5ed54 100644
--- a/tournaments/services/email_service.py
+++ b/tournaments/services/email_service.py
@@ -113,11 +113,18 @@ class TournamentEmailService:
link_text = f"informations sur {tournament_prefix_that}{tournament_word}"
absolute_url = f'{link_text}'
- body_parts.extend([
- f"\nDate d'inscription: {inscription_date}",
- f"\nÉquipe inscrite: {captain.name()} et {other_player.name()}",
- f"\nVoir les {absolute_url}"
- ])
+ if other_player:
+ body_parts.extend([
+ f"\nDate d'inscription: {inscription_date}",
+ f"\nÉquipe inscrite: {captain.name()} et {other_player.name()}",
+ f"\nVoir les {absolute_url}"
+ ])
+ else:
+ body_parts.extend([
+ f"\nDate d'inscription: {inscription_date}",
+ f"\nVotre inscription: {captain.name()}",
+ f"\nVoir les {absolute_url}"
+ ])
# Add payment information if applicable
if tournament.should_request_payment():
diff --git a/tournaments/templates/tournaments/navigation_tournament.html b/tournaments/templates/tournaments/navigation_tournament.html
index 266cfae..86d3910 100644
--- a/tournaments/templates/tournaments/navigation_tournament.html
+++ b/tournaments/templates/tournaments/navigation_tournament.html
@@ -4,36 +4,39 @@
Informations
- {% if tournament.supposedly_in_progress %}
- Live
- {% endif %}
+ {% if not tournament.is_custom_animation %}
+ {% if tournament.supposedly_in_progress %}
+ Live
+ {% endif %}
- {% if tournament.display_prog %}
- Programmation
- {% endif %}
+ {% if tournament.display_prog %}
+ Programmation
+ {% endif %}
- {% if tournament.display_matches and tournament.has_bracket %}
- Tableau
- {% endif %}
+ {% if tournament.display_matches and tournament.has_bracket %}
+ Tableau
+ {% endif %}
- {% if tournament.display_matches or tournament.display_group_stages %}
- Matchs
- {% endif %}
+ {% if tournament.display_matches or tournament.display_group_stages %}
+ Matchs
+ {% endif %}
- {% if tournament.display_group_stages %}
- Poules
- {% endif %}
+ {% if tournament.display_group_stages %}
+ Poules
+ {% endif %}
- {% if tournament.display_summons %}
- Convocations
- {% endif %}
+ {% if tournament.display_summons %}
+ Convocations
+ {% endif %}
- {% if tournament.display_teams %}
- Équipes
- {% endif %}
+ {% if tournament.display_teams %}
+ Équipes
+ {% endif %}
+
+ {% if tournament.display_rankings %}
+ Classement
+ {% endif %}
- {% if tournament.display_rankings %}
- Classement
{% endif %}
{% if user.is_authenticated %}
diff --git a/tournaments/views.py b/tournaments/views.py
index c0b58fe..2fc077f 100644
--- a/tournaments/views.py
+++ b/tournaments/views.py
@@ -65,6 +65,8 @@ from .services.payment_service import PaymentService
import logging
+from .models import AnimationType
+
logger = logging.getLogger(__name__)
def index(request):
@@ -119,6 +121,9 @@ def tournaments_query(query, club_id, ascending, limit=None):
club = get_object_or_404(Club, pk=club_id)
q_club = Q(event__club=club)
queries.append(q_club)
+ else:
+ q_animation_type = ~Q(animation_type=AnimationType.CUSTOM)
+ queries.append(q_animation_type)
sortkey = 'start_date'
if not ascending: