1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-11-09 15:09:31 +01:00

Add distinction between scientific coach and accompanying coach

This commit is contained in:
Maxime JUST
2025-11-07 17:24:53 +01:00
parent 8af11cd56f
commit 7ae98cd64d
9 changed files with 528 additions and 437 deletions

View File

@@ -70,13 +70,21 @@ class Team(models.Model):
@property
def coaches(self):
return self.participants.filter(coachregistration__isnull=False)
@property
def scientific_coaches(self):
return self.participants.filter(coachregistration__isnull=False, coachregistration__is_scientific_coach=True)
@property
def accompanying_coaches(self):
return self.participants.filter(coachregistration__isnull=False, coachregistration__is_accompanying_coach=True)
def can_validate(self):
if any(not r.email_confirmed for r in self.participants.all()):
return False
if self.students.count() < 4:
return False
if not self.coaches.exists():
if not self.scientific_coaches.exists():
return False
if not self.participation.tournament:
return False
@@ -211,6 +219,7 @@ class Team(models.Model):
:return: The mailing list to contact the team members.
"""
return f"equipe-{slugify(self.trigram)}@{settings.SYMPA_HOST}"
def create_mailing_list(self):
"""