1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-20 19:41:20 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Yohann D'ANELLO
4dd3c105fe
Only consider a participant as a child if it is not 18 on the beginning of the tournament 2021-01-23 14:30:00 +01:00
Yohann D'ANELLO
a0266c691b
Coaches have no health sheet 2021-01-23 14:27:21 +01:00
2 changed files with 8 additions and 2 deletions

View File

@ -391,7 +391,7 @@ class TeamAuthorizationsView(LoginRequiredMixin, DetailView):
_("Parental authorization of {participant}.{ext}")
.format(participant=str(participant), ext=ext))
if participant.health_sheet:
if isinstance(participant, StudentRegistration) and participant.health_sheet:
mime_type = magic.from_file("media/" + participant.health_sheet.name)
ext = mime_type.split("/")[1].replace("jpeg", "jpg")
zf.write("media/" + participant.health_sheet.name,

View File

@ -159,7 +159,13 @@ class ParticipantRegistration(Registration):
@property
def under_18(self):
return (timezone.now().date() - self.birth_date).days < 18 * 365.24
important_date = 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
@property
def type(self): # pragma: no cover