1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 11:18:27 +02:00

Auto select the single tournament for ETEAM

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-06-07 17:24:24 +02:00
parent e026f49f8d
commit 73ea3d1717
4 changed files with 118 additions and 0 deletions

View File

@ -75,6 +75,12 @@ class ParticipationForm(forms.ModelForm):
"""
Form to update the problem of a team participation.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if settings.TFJM_APP == "ETEAM":
# One single tournament only
del self.fields['tournament']
class Meta:
model = Participation
fields = ('tournament', 'final',)

View File

@ -15,6 +15,8 @@ def create_team_participation(instance, created, raw, **_):
"""
if not raw:
participation = Participation.objects.get_or_create(team=instance)[0]
if settings.TFJM_APP == "ETEAM":
participation.tournament = Tournament.objects.first()
participation.save()
if not created:
participation.team.create_mailing_list()