Disable interactive mode of the syncdb command, fixed #696

This commit is contained in:
Norman Jäckel 2013-06-13 19:41:42 +02:00
parent 69f7e22320
commit dfc160af5b

View File

@ -20,6 +20,15 @@ class Command(_Command):
Setup the database and sends the signal post_database_setup. Setup the database and sends the signal post_database_setup.
""" """
def handle_noargs(self, *args, **kwargs): 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) 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 return return_value