diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-01-24 22:33:54 +0000 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-01-24 22:33:54 +0000 |
commit | 80f9f6f67531314f870cb4ad034918f99cd2f1de (patch) | |
tree | fd71e9f31b7cd3ea30d6dadf2d2230c64cba4677 /chimere | |
parent | 799048b21b465eb097c03b4936e0077cf9148466 (diff) | |
download | Chimère-80f9f6f67531314f870cb4ad034918f99cd2f1de.tar.bz2 Chimère-80f9f6f67531314f870cb4ad034918f99cd2f1de.zip |
Fix database initialisation for upgrade.
Diffstat (limited to 'chimere')
-rw-r--r-- | chimere/fixtures/auth_group.json | 46 | ||||
-rw-r--r-- | chimere/fixtures/initial_data.json | 44 | ||||
-rw-r--r-- | chimere/models.py | 5 |
3 files changed, 50 insertions, 45 deletions
diff --git a/chimere/fixtures/auth_group.json b/chimere/fixtures/auth_group.json new file mode 100644 index 0000000..e04291c --- /dev/null +++ b/chimere/fixtures/auth_group.json @@ -0,0 +1,46 @@ +[ + { + "pk": 1, + "model": "auth.group", + "fields": { + "name": "Application administrator", + "permissions": [ + 67, + 68, + 40, + 41, + 42, + 37, + 38, + 39, + 34, + 35, + 36, + 43, + 44, + 45, + 49, + 50, + 51, + 55, + 56, + 57, + 28, + 29, + 30, + 58, + 59, + 60, + 64, + 65, + 66, + 61, + 62, + 63, + 46, + 47, + 48 + ] + } + } +] diff --git a/chimere/fixtures/initial_data.json b/chimere/fixtures/initial_data.json index 222c81c..c44eb63 100644 --- a/chimere/fixtures/initial_data.json +++ b/chimere/fixtures/initial_data.json @@ -221,49 +221,5 @@ "layer_code": "new OpenLayers.Layer.MapQuestOSM()", "name": "OSM - MapQuest" } - }, - { - "pk": 1, - "model": "auth.group", - "fields": { - "name": "Application administrator", - "permissions": [ - 67, - 68, - 40, - 41, - 42, - 37, - 38, - 39, - 34, - 35, - 36, - 43, - 44, - 45, - 49, - 50, - 51, - 55, - 56, - 57, - 28, - 29, - 30, - 58, - 59, - 60, - 64, - 65, - 66, - 61, - 62, - 63, - 46, - 47, - 48 - ] - } } ] diff --git a/chimere/models.py b/chimere/models.py index 827a0e7..5a4be28 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1283,7 +1283,10 @@ def area_post_save(sender, **kwargs): ('chimere', 'multimediafile'), ('chimere', 'picturefile'), ('chimere', 'routefile')): - ct = ContentType.objects.get(app_label=app_label, model=model) + ct = ContentType.objects.filter(app_label=app_label, model=model) + if not ct.count(): + continue + ct = ct.all()[0] for p in Permission.objects.filter(content_type=ct).all(): group.permissions.add(p) |