Events: one more validation check
This commit is contained in:
parent
5a0cf58d8a
commit
24180e747e
1 changed files with 6 additions and 0 deletions
|
@ -156,6 +156,12 @@ class Registration(models.Model):
|
|||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
options_choices = models.ManyToManyField(OptionChoice)
|
||||
|
||||
def clean(self):
|
||||
if not all((ch.option.event == self.event for ch in self.options_choices)):
|
||||
raise ValidationError(
|
||||
_("Choix d'options incohérents avec l'événement pour cette inscription")
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("inscription à un événement")
|
||||
verbose_name_plural = _("inscriptions à un événement")
|
||||
|
|
Loading…
Reference in a new issue