diff --git a/competition/models.py b/competition/models.py index 6dff6385..caea9723 100644 --- a/competition/models.py +++ b/competition/models.py @@ -210,6 +210,11 @@ class Meta: blank=True, default=None) + def save(self, *args, **kwargs) -> None: + if not self.frozen_results: + self.frozen_results = None + return super().save(*args, **kwargs) + def get_first_series(self): return self.series_set.get(order=1) @@ -257,6 +262,11 @@ class Meta: blank=True, default=None) + def save(self, *args, **kwargs) -> None: + if not self.frozen_results: + self.frozen_results = None + return super().save(*args, **kwargs) + def __str__(self): return f'{self.semester} - {self.order}. séria' @@ -421,6 +431,11 @@ class Meta: hidden_response = models.TextField( null=True, blank=True, verbose_name='Skrytá odpoveď na komentár') + def save(self, *args, **kwargs) -> None: + if not self.hidden_response: + self.hidden_response = None + return super().save(*args, **kwargs) + def publish(self): self.state = CommentPublishState.PUBLISHED self.hidden_response = None