summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 826b9000f..5f57e8398 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1593,9 +1593,13 @@ class IshtarSiteProfile(models.Model, Cached):
return value
q = cls.objects.filter(active=True)
if not q.count():
- obj = cls.objects.create(
- label="Default profile", slug="default", active=True
+ obj, created = cls.objects.get_or_create(
+ slug="default",
+ defaults={"label": "Default profile", "active": True}
)
+ if not created:
+ obj.active = True
+ obj.save()
else:
obj = q.all()[0]
cache.set(cache_key, obj, settings.CACHE_TIMEOUT)