From 56167a21b52b4ac18764f6cb6c73c037d432f775 Mon Sep 17 00:00:00 2001 From: alexismdr Date: Tue, 9 Dec 2025 19:28:56 +0100 Subject: [PATCH] feat: check min/max promotion year * min year is 1912 (ENSET creation year) * max year is same as default WARNING : Changing this behavior could break iOS/Android apps. Please change Swift/Kotlin code accordingly. --- apps/member/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/member/models.py b/apps/member/models.py index e08d4b59..f0794a03 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -19,6 +19,7 @@ from phonenumber_field.modelfields import PhoneNumberField from permission.models import Role from registration.tokens import email_validation_token from note.models import MembershipTransaction +from django.core.validators import MaxValueValidator, MinValueValidator class Profile(models.Model): @@ -76,6 +77,7 @@ class Profile(models.Model): default=datetime.date.today().year if datetime.date.today().month >= 8 else datetime.date.today().year - 1, verbose_name=_("promotion"), help_text=_("Year of entry to the school (None if not ENS student)"), + validators=[MinValueValidator(1912), MaxValueValidator(datetime.date.today().year if datetime.date.today().month >= 8 else datetime.date.today().year - 1)], ) address = models.CharField(