* Cleanup
This commit is contained in:
parent
c730bdb20c
commit
dd52427ef5
|
|
@ -35,13 +35,14 @@ class GlobalSettings(models.Model):
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
# Store only one instance of GlobalSettings
|
# Store only one instance of GlobalSettings
|
||||||
|
self.id = 1
|
||||||
self.__class__.objects.exclude(id=self.id).delete()
|
self.__class__.objects.exclude(id=self.id).delete()
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
InMemoryCache.set('GlobalSettings', self)
|
InMemoryCache.set('GlobalSettings', self)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f'GlobalSettings for {self.id}'
|
return f'GlobalSettings <{self.id}>'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls) -> 'GlobalSettings':
|
def load(cls) -> 'GlobalSettings':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user