From dfc160af5be75fced21283bf563171ca97ceff18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 13 Jun 2013 19:41:42 +0200 Subject: [PATCH] Disable interactive mode of the syncdb command, fixed #696 --- openslides/utils/management/commands/syncdb.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/openslides/utils/management/commands/syncdb.py b/openslides/utils/management/commands/syncdb.py index 2835fb220..48c9ce0ab 100644 --- a/openslides/utils/management/commands/syncdb.py +++ b/openslides/utils/management/commands/syncdb.py @@ -20,6 +20,15 @@ class Command(_Command): Setup the database and sends the signal post_database_setup. """ def handle_noargs(self, *args, **kwargs): - return_value = super(Command, self).handle_noargs(*args, **kwargs) + """ + Calls Django's syncdb command but always in non-interactive mode. After + this it sends our post_database_setup signal. + """ + interactive = kwargs.pop('interactive') + return_value = super(Command, self).handle_noargs(*args, interactive=False, **kwargs) post_database_setup.send(sender=self) + if interactive: + print('Interactive mode (e. g. creating a superuser) is not possibile ' + 'via this command. To create a superuser use the --reset-admin ' + 'option of the main script.') return return_value