diff --git a/apps/school/models.py b/apps/school/models.py index 0151f5f0..18c905a6 100644 --- a/apps/school/models.py +++ b/apps/school/models.py @@ -115,6 +115,11 @@ class LiveLesson(BaseModel, DeactivatedMixin): def __str__(self): return self.title + def save(self, *args, **kwargs): + if not self.id and LiveLesson.objects.filter(date=self.date).exists(): + self.date = (datetime.combine(self.date, now().time()) + timedelta(days=1)).date() + super().save(*args, **kwargs) + def stream_index(self): return self.stream.split('/')[-1]