From ee0fd9ac93582472c1aae9d2d52657acf9cb00f3 Mon Sep 17 00:00:00 2001 From: Anet Date: Fri, 10 May 2019 23:59:15 +0200 Subject: [PATCH] management/commands/testdata.py: NoArgsCommand je deprecated od verze 1.1O, nahrada je BaseCommand --- seminar/management/commands/testdata.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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()))