From fdf33c2296b64bf50f3259c82e1b10900e1be24f Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 18 Jul 2014 13:31:41 -0400 Subject: [PATCH] Only create the object during the signal handling --- mayan/apps/installation/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mayan/apps/installation/__init__.py b/mayan/apps/installation/__init__.py index a17cfd7fbb..bc9a38aa7a 100644 --- a/mayan/apps/installation/__init__.py +++ b/mayan/apps/installation/__init__.py @@ -20,14 +20,15 @@ from .models import Installation def trigger_first_time(sender, **kwargs): if kwargs['app'] == 'installation': details, created = Installation.objects.get_or_create() - details.is_first_run = True - details.save() + if created: + details.is_first_run = True + details.save() def check_first_run(): try: with transaction.atomic(): - details, created = Installation.objects.get_or_create() + details = Installation.objects.get() except DatabaseError: # Avoid database errors when the app tables haven't been created yet pass