summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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
commit80f9f6f67531314f870cb4ad034918f99cd2f1de (patch)
treefd71e9f31b7cd3ea30d6dadf2d2230c64cba4677
parent799048b21b465eb097c03b4936e0077cf9148466 (diff)
downloadChimère-80f9f6f67531314f870cb4ad034918f99cd2f1de.tar.bz2
Chimère-80f9f6f67531314f870cb4ad034918f99cd2f1de.zip
Fix database initialisation for upgrade.
-rw-r--r--chimere/fixtures/auth_group.json46
-rw-r--r--chimere/fixtures/initial_data.json44
-rw-r--r--chimere/models.py5
-rw-r--r--docs/en/install.rst4
-rw-r--r--docs/fr/install.rst5
-rw-r--r--example_project/fixtures/first_data.json (renamed from example_project/fixtures/initial_data.json)0
6 files changed, 59 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)
diff --git a/docs/en/install.rst b/docs/en/install.rst
index ea27efc..3c2f54b 100644
--- a/docs/en/install.rst
+++ b/docs/en/install.rst
@@ -244,6 +244,10 @@ to create tables managed with Django-South::
The database is set, congratulations!
+You can load the default group permissions (it is at least a good start)::
+
+ ./manage.py loaddata ../chimere/fixtures/auth_group.json
+
If you want to populate your installation with default data (don't do this on
an already populated instance!)::
diff --git a/docs/fr/install.rst b/docs/fr/install.rst
index 841eae2..de41584 100644
--- a/docs/fr/install.rst
+++ b/docs/fr/install.rst
@@ -252,6 +252,11 @@ données gérées par Django-South : ::
La base de données est en place, félicitations !
+Vous pouvez alors charger les permissions poar défaut pour les groupes
+(c'est au minimum un bon départ) : ::
+
+ ./manage.py loaddata ../chimere/fixtures/auth_group.json
+
Si vous voulez remplir votre installation avec des données par défaut (ne le
faites pas sur une instance de Chimère contenant déjà des données !) : ::
diff --git a/example_project/fixtures/initial_data.json b/example_project/fixtures/first_data.json
index 814e8e0..814e8e0 100644
--- a/example_project/fixtures/initial_data.json
+++ b/example_project/fixtures/first_data.json