diff --git a/registration/models.py b/registration/models.py index 48e9dc5..0022696 100644 --- a/registration/models.py +++ b/registration/models.py @@ -224,7 +224,11 @@ class ParticipantRegistration(Registration): important_date = localtime(timezone.now()).date() if self.team and self.team.participation.tournament: important_date = self.team.participation.tournament.date_start - over_18_on = self.birth_date.replace(year=self.birth_date.year + 18) + birth_date = self.birth_date + if self.birth_date.month == 2 and self.birth_date.day == 29: + # If the birth date is the 29th of February, we consider it as the 1st of March + birth_date = important_date.replace(month=3, day=1) + over_18_on = birth_date.replace(year=birth_date.year + 18) return important_date < over_18_on @property @@ -233,7 +237,10 @@ class ParticipantRegistration(Registration): 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) + if self.birth_date.month == 2 and self.birth_date.day == 29: + # If the birth date is the 29th of February, we consider it as the 1st of March + birth_date = important_date.replace(month=3, day=1) + over_18_on = birth_date.replace(year=birth_date.year + 18) return important_date < over_18_on @property