mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-24 15:00:30 +02:00
Add button to update notes
Add jury president field for pools Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -8,7 +8,7 @@ from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator
|
||||
from django.db import models
|
||||
from django.db.models import Index
|
||||
from django.db.models import F, Index, Q
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
from django.utils.crypto import get_random_string
|
||||
@ -543,6 +543,15 @@ class Pool(models.Model):
|
||||
verbose_name=_("juries"),
|
||||
)
|
||||
|
||||
jury_president = models.ForeignKey(
|
||||
VolunteerRegistration,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
default=None,
|
||||
related_name="pools_presided",
|
||||
verbose_name=_("president of the jury"),
|
||||
)
|
||||
|
||||
bbb_url = models.CharField(
|
||||
max_length=255,
|
||||
blank=True,
|
||||
@ -573,6 +582,11 @@ class Pool(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse_lazy("participation:pool_detail", args=(self.pk,))
|
||||
|
||||
def validate_constraints(self, exclude=None):
|
||||
if self.jury_president not in self.juries.all():
|
||||
raise ValidationError({'jury_president': _("The president of the jury must be part of the jury.")})
|
||||
return super().validate_constraints()
|
||||
|
||||
def __str__(self):
|
||||
return _("Pool of day {round} for tournament {tournament} with teams {teams}")\
|
||||
.format(round=self.round,
|
||||
|
Reference in New Issue
Block a user