add more default user infos on first subscription

This commit is contained in:
imperosol
2025-11-11 15:07:06 +01:00
parent 2d60ae2ed8
commit d0340603a2
4 changed files with 44 additions and 7 deletions

View File

@@ -54,6 +54,8 @@ from django.utils.translation import gettext_lazy as _
from phonenumber_field.modelfields import PhoneNumberField
from PIL import Image, ImageOps
from core.utils import get_last_promo
if TYPE_CHECKING:
from django.core.files.uploadedfile import UploadedFile
from pydantic import NonNegativeInt
@@ -86,12 +88,11 @@ class Group(AuthGroup):
def validate_promo(value: int) -> None:
start_year = settings.SITH_SCHOOL_START_YEAR
delta = (localdate() + timedelta(days=180)).year - start_year
if value < 0 or delta < value:
last_promo = get_last_promo()
if not 0 < value <= last_promo:
raise ValidationError(
_("%(value)s is not a valid promo (between 0 and %(end)s)"),
params={"value": value, "end": delta},
params={"value": value, "end": last_promo},
)