diff --git a/src/pretix/base/models/items.py b/src/pretix/base/models/items.py index 82186e28d..90a19935b 100644 --- a/src/pretix/base/models/items.py +++ b/src/pretix/base/models/items.py @@ -1915,6 +1915,15 @@ class Question(LoggedModel): if event != item.event: raise ValidationError(_('One or more items do not belong to this event.')) + def clean(self): + if self.valid_date_max and self.valid_date_min and self.valid_date_min > self.valid_date_max: + raise ValidationError(_("The maximum date must not be before the minimum value.")) + if self.valid_datetime_max and self.valid_datetime_min and self.valid_datetime_min > self.valid_datetime_max: + raise ValidationError(_("The maximum date must not be before the minimum value.")) + if self.valid_number_max and self.valid_number_min and self.valid_number_min > self.valid_number_max: + raise ValidationError(_("The maximum value must not be lower than the minimum value.")) + super().clean() + class QuestionOption(models.Model): question = models.ForeignKey('Question', related_name='options', on_delete=models.CASCADE)