From 992dc9702463e60c2ab2c480577f89fef1bddcc4 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 19 Sep 2018 10:06:09 +0200 Subject: [PATCH] Fix initial migration Initial migration was failing due to change_facture_pdf not being initialised at the right time. --- cotisations/migrations/0032_custom_invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cotisations/migrations/0032_custom_invoice.py b/cotisations/migrations/0032_custom_invoice.py index 68963bf5..39c23e8b 100644 --- a/cotisations/migrations/0032_custom_invoice.py +++ b/cotisations/migrations/0032_custom_invoice.py @@ -30,7 +30,9 @@ def update_rights(apps, schema_editor): create_permissions(app) app.models_module = False - former = Permission.objects.get(codename='change_facture_pdf') + ContentType = apps.get_model("contenttypes", "ContentType") + content_type = ContentType.objects.get_for_model(Permission) + former, created = Permission.objects.get_or_create(codename='change_facture_pdf', content_type=content_type) new_1 = Permission.objects.get(codename='add_custominvoice') new_2 = Permission.objects.get(codename='change_custominvoice') new_3 = Permission.objects.get(codename='view_custominvoice')