From 4db0acbb73829b490425e72ccec7823f1e87c300 Mon Sep 17 00:00:00 2001 From: Tuomas Laine Date: Tue, 30 May 2023 13:47:57 +0000 Subject: [PATCH] Check that starting and ending times are not None Closes #1174. --- course/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course/models.py b/course/models.py index 575f1590c..c58e64861 100644 --- a/course/models.py +++ b/course/models.py @@ -707,7 +707,7 @@ def clean(self): errors['instance_name'] = format_lazy(_('COURSE_INSTANCE_ERROR_INSTANCE_NAME -- {}'), self.instance_name) if self.url in RESERVED: errors['url'] = format_lazy(_('COURSE_INSTANCE_ERROR_URL -- {}'), self.url) - if self.ending_time <= self.starting_time: + if self.ending_time and self.starting_time and self.ending_time <= self.starting_time: errors['ending_time'] = _('COURSE_INSTANCE_ERROR_ENDING_TIME_BEFORE_STARTING') if self.lifesupport_time and self.lifesupport_time < self.ending_time: errors['lifesupport_time'] = _('COURSE_INSTANCE_ERROR_LIFESUPPORT_TIME_BEFORE_ENDING')