1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-12-09 21:27:47 +01:00

Compare commits

..

2 Commits

Author SHA1 Message Date
alexismdr
a25afea16d fix: line length for linters 2025-12-09 20:19:29 +01:00
alexismdr
56167a21b5 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.
2025-12-09 19:28:56 +01:00

View File

@@ -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,10 @@ 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(