diff --git a/seminar/management/commands/testdata.py b/seminar/management/commands/testdata.py index dda7b097..0216a180 100644 --- a/seminar/management/commands/testdata.py +++ b/seminar/management/commands/testdata.py @@ -4,7 +4,7 @@ import datetime import os import random -from django.core.management.base import NoArgsCommand +from django.core.management.base import BaseCommand from django.core.management import call_command from django.conf import settings @@ -14,7 +14,7 @@ import django.contrib.auth User = django.contrib.auth.get_user_model() -class Command(NoArgsCommand): +class Command(BaseCommand): help = "Clear database and load testing data." def handle_noargs(self, **options): @@ -26,9 +26,10 @@ class Command(NoArgsCommand): call_command('migrate', noinput=True) self.stdout.write('Vytvarim uzivatele "admin" (heslo "admin") a pseudo-nahodna data ...') create_test_data(size=8) - self.stdout.write('Vytvoreno %d uzivatelu, %d skol, %d resitelu, %d rocniku, %d cisel, %d problemu, %d reseni.' % - (User.objects.count(), Skola.objects.count(), Resitel.objects.count(), Rocnik.objects.count(), - Cislo.objects.count(), Problem.objects.count(), Reseni.objects.count())) + self.stdout.write('Vytvoreno %d uzivatelu, %d skol, %d resitelu, %d rocniku, %d cisel, + %d problemu, %d reseni.'.format(User.objects.count(), Skola.objects.count(), + Resitel.objects.count(), Rocnik.objects.count(), Cislo.objects.count(), + Problem.objects.count(), Reseni.objects.count()))