1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-23 06:36:35 +02:00

Implement final selection

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-04-07 11:40:58 +02:00
parent 7732a737bb
commit 1493df0078
15 changed files with 657 additions and 310 deletions

View File

@ -210,17 +210,31 @@ class ParticipantRegistration(Registration):
default="",
)
photo_authorization_final = models.FileField(
verbose_name=_("photo authorization (final)"),
upload_to=get_random_photo_filename,
blank=True,
default="",
)
@property
def under_18(self):
if isinstance(self, CoachRegistration):
return False # In normal case
important_date = timezone.now().date()
important_date = localtime(timezone.now()).date()
if self.team and self.team.participation.tournament:
important_date = self.team.participation.tournament.date_start
if self.team.participation.final:
from participation.models import Tournament
important_date = Tournament.final_tournament().date_start
return (important_date - self.birth_date).days < 18 * 365.24
over_18_on = self.birth_date.replace(year=self.birth_date.year + 18)
return important_date < over_18_on
@property
def under_18_final(self):
if isinstance(self, CoachRegistration):
return False # In normal case
from participation.models import Tournament
important_date = Tournament.final_tournament().date_start
over_18_on = self.birth_date.replace(year=self.birth_date.year + 18)
return important_date < over_18_on
@property
def type(self): # pragma: no cover
@ -314,6 +328,13 @@ class StudentRegistration(ParticipantRegistration):
default="",
)
parental_authorization_final = models.FileField(
verbose_name=_("parental authorization (final)"),
upload_to=get_random_parental_filename,
blank=True,
default="",
)
health_sheet = models.FileField(
verbose_name=_("health sheet"),
upload_to=get_random_health_filename,