summaryrefslogtreecommitdiff
path: root/chimere/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/models.py')
-rw-r--r--chimere/models.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/chimere/models.py b/chimere/models.py
index 5a4be28..6b0d4b3 100644
--- a/chimere/models.py
+++ b/chimere/models.py
@@ -1255,11 +1255,14 @@ def area_post_save(sender, **kwargs):
perm = Permission.objects.filter(codename=mnemo)
lbl = "Can change " + area.name
if not perm.count():
- content_type = ContentType.objects.get(app_label="chimere",
+ try:
+ content_type = ContentType.objects.get(app_label="chimere",
model="area")
- perm = Permission(name=lbl, content_type_id=content_type.id,
- codename=mnemo)
- perm.save()
+ perm = Permission(name=lbl, content_type_id=content_type.id,
+ codename=mnemo)
+ perm.save()
+ except ObjectDoesNotExist:
+ pass
else:
perm = perm.all()[0]
if old_name != area.name: