Skip to content

Commit

Permalink
Merge pull request #298 from ZdruzenieSTROM/nulls
Browse files Browse the repository at this point in the history
Umožnené uložiť NULL v django admine
  • Loading branch information
mmihalik authored Dec 8, 2023
2 parents 0bb0a06 + 34f4cde commit 1b0a310
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions competition/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1b0a310

Please sign in to comment.