add stdout log

This commit is contained in:
Ludovic Stephan 2017-02-08 15:54:49 -02:00
parent 01dbf7293c
commit 9ade88d076

View file

@ -49,31 +49,42 @@ class Command(MyBaseCommand):
# Comptes
# ---
self.stdout.write("Création des comptes K-Fêt")
gaulois = CofProfile.objects.filter(user__last_name='Gaulois')
gaulois_trigramme = map('{:03d}'.format, range(50))
romains = CofProfile.objects.filter(user__last_name='Romain')
romains_trigramme = map(lambda x: str(100+x), range(99))
created_accounts = 0
team_accounts = 0
for (profile, trigramme) in zip(gaulois, gaulois_trigramme):
account, _ = Account.objects.get_or_create(
account, created = Account.objects.get_or_create(
trigramme=trigramme,
cofprofile=profile,
defaults={'balance': random.randint(1, 999)/10}
)
created_accounts += int(created)
if profile.user.first_name == 'Abraracourcix':
profile.user.groups.add(group_chef)
for (profile, trigramme) in zip(romains, romains_trigramme):
account, _ = Account.objects.get_or_create(
account, created = Account.objects.get_or_create(
trigramme=trigramme,
cofprofile=profile,
defaults={'balance': random.randint(1, 999)/10}
)
created_accounts += int(created)
if random.random() > 0.75:
if random.random() > 0.75 and created:
profile.user.groups.add(group_boy)
team_accounts += 1
self.stdout.write("- {:d} comptes créés, {:d} dans l'équipe K-Fêt"
.format(created_accounts, team_accounts))
# Compte liquide
@ -97,6 +108,8 @@ class Command(MyBaseCommand):
# Opérations
# ---
self.stdout.write("Génération d'opérations")
articles = Article.objects.all()
accounts = Account.objects.exclude(trigramme='LIQ')