Make the intialsetup and performupgrade management tasks

work with signals to allow customization from 3rd party apps.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-07-24 16:32:30 -04:00
parent 76539f9eb0
commit 60cc0346fe
5 changed files with 35 additions and 18 deletions

View File

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.core import management
from django.db.utils import OperationalError
from ...signals import post_initial_setup
from ...signals import post_initial_setup, pre_initial_setup
class Command(management.BaseCommand):
@@ -11,17 +11,6 @@ class Command(management.BaseCommand):
def handle(self, *args, **options):
management.call_command('createsettings', interactive=False)
try:
management.call_command('migrate', interactive=False)
except OperationalError:
self.stderr.write(
self.style.NOTICE(
'Unable to migrate the database. The initialsetup '
'command is to be used only on new installations. To '
'upgrade existing installations use the performupgrade '
'command.'
)
)
raise
pre_initial_setup.send(sender=self)
management.call_command('createautoadmin', interactive=False)
post_initial_setup.send(sender=self)