Create RegistrationSingleton only after db exists
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.db import transaction, DatabaseError
|
||||
from django.dispatch import receiver
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from south.signals import post_migrate
|
||||
|
||||
from common import about_view, license_view
|
||||
from navigation.api import register_links
|
||||
|
||||
@@ -18,8 +20,7 @@ form_view = {'text': _('Registration'), 'view': 'form_view', 'famfam': 'telephon
|
||||
register_links(['form_view'], [about_view, license_view], menu_name='secondary_menu')
|
||||
register_links(['form_view', 'about_view', 'license_view'], [form_view], menu_name='secondary_menu')
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
|
||||
@receiver(post_migrate, dispatch_uid='trigger_first_time', sender=RegistrationSingleton)
|
||||
def trigger_first_time(sender, **kwargs):
|
||||
RegistrationSingleton.objects.get_or_create()
|
||||
except DatabaseError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user