From fbf288039cc9ba2a41ce43a1fd1cb7cf2f3efbb2 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 14 Aug 2019 01:45:06 +0200 Subject: [PATCH] Testdata command: tabs --- seminar/management/commands/testdata.py | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/seminar/management/commands/testdata.py b/seminar/management/commands/testdata.py index 6a7fb30c..d770f77b 100644 --- a/seminar/management/commands/testdata.py +++ b/seminar/management/commands/testdata.py @@ -15,21 +15,21 @@ User = django.contrib.auth.get_user_model() class Command(BaseCommand): - help = "Clear database and load testing data." - - def handle(self, *args, **options): - assert settings.DEBUG == True - dbfile = settings.DATABASES['default']['NAME'] - if os.path.exists(dbfile): - os.rename(dbfile, dbfile + '.old') - self.stderr.write('Stara databaze prejmenovana na "%s"' % (dbfile + '.old')) - call_command('migrate', no_input=True) - self.stdout.write('Vytvarim uzivatele "admin" (heslo "admin") a pseudo-nahodna data ...') - create_test_data(size=8) - self.stdout.write('Vytvoreno {} uzivatelu, {} skol, {} resitelu, {} rocniku, {} cisel,' - ' {} problemu, {} reseni.'.format(User.objects.count(), Skola.objects.count(), - Resitel.objects.count(), Rocnik.objects.count(), Cislo.objects.count(), - Problem.objects.count(), Reseni.objects.count())) + help = "Clear database and load testing data." + + def handle(self, *args, **options): + assert settings.DEBUG == True + dbfile = settings.DATABASES['default']['NAME'] + if os.path.exists(dbfile): + os.rename(dbfile, dbfile + '.old') + self.stderr.write('Stara databaze prejmenovana na "%s"' % (dbfile + '.old')) + call_command('migrate', no_input=True) + self.stdout.write('Vytvarim uzivatele "admin" (heslo "admin") a pseudo-nahodna data ...') + create_test_data(size=8) + self.stdout.write('Vytvoreno {} uzivatelu, {} skol, {} resitelu, {} rocniku, {} cisel,' + ' {} problemu, {} reseni.'.format(User.objects.count(), Skola.objects.count(), + Resitel.objects.count(), Rocnik.objects.count(), Cislo.objects.count(), + Problem.objects.count(), Reseni.objects.count()))