This commit is contained in:
2024-12-11 23:22:09 +01:00
parent 4b86b33872
commit 9b7944c14d
53 changed files with 2054 additions and 249 deletions

View File

@@ -1,12 +1,12 @@
import random
import string
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_stubs_ext.db.models import TypedModelMeta
from ..helpers import generate_season_code
User = get_user_model()
class Season(models.Model):
name = models.CharField(max_length=64, verbose_name=_("name"))
@@ -25,6 +25,11 @@ class Season(models.Model):
preregister_candidates = models.BooleanField(
default=True, verbose_name=_("preregister candidates")
)
owner = models.ManyToManyField(
User,
verbose_name=_("owners"),
related_name="seasons",
)
def renew_season_code(self) -> str:
self.season_code = generate_season_code()