* Cleanup

This commit is contained in:
Phil Zhitnikov 2023-07-07 03:26:17 +04:00
parent c730bdb20c
commit dd52427ef5

View File

@ -35,13 +35,14 @@ class GlobalSettings(models.Model):
def save(self, *args, **kwargs):
# Store only one instance of GlobalSettings
self.id = 1
self.__class__.objects.exclude(id=self.id).delete()
super().save(*args, **kwargs)
InMemoryCache.set('GlobalSettings', self)
def __str__(self) -> str:
return f'GlobalSettings for {self.id}'
return f'GlobalSettings <{self.id}>'
@classmethod
def load(cls) -> 'GlobalSettings':