From c9be24b785c65546893fc43d44d76b1f761aa072 Mon Sep 17 00:00:00 2001 From: Jonas Havelka Date: Thu, 25 Jun 2020 13:08:27 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99id=C3=A1na=20podm=C3=ADnka=20na=20datumy?= =?UTF-8?q?=20u=20organiz=C3=A1tora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/seminar/models.py b/seminar/models.py index 69e313b6..deb0c9b9 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -13,7 +13,7 @@ from django.utils.encoding import force_text from django.utils.text import slugify from django.urls import reverse from django.core.cache import cache -from django.core.exceptions import ObjectDoesNotExist +from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.contrib.contenttypes.models import ContentType from django.utils.text import get_valid_filename from imagekit.models import ImageSpecField, ProcessedImageField @@ -581,6 +581,11 @@ class Organizator(SeminarModelBase): help_text="Škola, např. MFF, VŠCHT, VUT, ... prostě aby se nemuselo psát do studuje" "školu, ale jen obor, možnost zobrazit zvlášť") + def clean(self): + if self.organizuje_od > self.organizuje_do: + raise ValidationError("Organizátor nemůže skončit s organizováním dříve než začal!") + super().clean() + def __str__(self): if self.osoba.prezdivka: return "{} '{}' {}".format(self.osoba.jmeno,