2013-03-11 21:32:09 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from django.core.management.commands.syncdb import Command as _Command
|
|
|
|
|
|
|
|
from openslides.core.signals import post_database_setup
|
|
|
|
|
|
|
|
|
|
|
|
class Command(_Command):
|
|
|
|
"""
|
|
|
|
Setup the database and sends the signal post_database_setup.
|
|
|
|
"""
|
|
|
|
def handle_noargs(self, *args, **kwargs):
|
2013-06-13 19:41:42 +02:00
|
|
|
"""
|
|
|
|
Calls Django's syncdb command but always in non-interactive mode. After
|
|
|
|
this it sends our post_database_setup signal.
|
|
|
|
"""
|
2013-06-16 12:00:57 +02:00
|
|
|
interactive = kwargs.get('interactive', False)
|
|
|
|
kwargs['interactive'] = False
|
|
|
|
return_value = super(Command, self).handle_noargs(*args, **kwargs)
|
2013-03-11 21:32:09 +01:00
|
|
|
post_database_setup.send(sender=self)
|
2013-06-16 12:00:57 +02:00
|
|
|
|
2013-06-13 19:41:42 +02:00
|
|
|
if interactive:
|
|
|
|
print('Interactive mode (e. g. creating a superuser) is not possibile '
|
2013-06-16 12:00:57 +02:00
|
|
|
'in OpenSlides. A superuser is automaticly created.')
|
2013-03-11 21:32:09 +01:00
|
|
|
return return_value
|