From 4f4bbf6d0e6b5c98ffbb2f6b6ad6d0f4ade3d609 Mon Sep 17 00:00:00 2001
From: Yohann D'ANELLO <yohann.danello@gmail.com>
Date: Fri, 27 Mar 2020 16:32:46 +0100
Subject: [PATCH] Fix server starting

---
 apps/note/forms.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/apps/note/forms.py b/apps/note/forms.py
index d819644f..43c7b395 100644
--- a/apps/note/forms.py
+++ b/apps/note/forms.py
@@ -35,7 +35,9 @@ class TransactionTemplateForm(forms.ModelForm):
                     NoteClub,
                     attrs={
                         'api_url': '/api/note/note/',
-                        'api_url_suffix': '&polymorphic_ctype=' + str(ContentType.objects.get_for_model(NoteClub).pk),
+                        # We don't evaluate the content type at launch because the DB might be not initialized
+                        'api_url_suffix':
+                            lambda value: '&polymorphic_ctype=' + str(ContentType.objects.get_for_model(NoteClub).pk),
                         'placeholder': 'Note ...',
                     },
                 ),
-- 
GitLab