Export games

This commit is contained in:
Yohann D'ANELLO 2020-10-26 15:13:19 +01:00
parent a64d600645
commit 4de83344a7
1 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,7 @@ from argparse import FileType
from sys import stdin
from django.core.management import BaseCommand
from media.models import BD, CD, Manga, Revue, Roman, Vinyle
from media.models import BD, CD, Manga, Revue, Roman, Vinyle, Jeu
class Command(BaseCommand):
@ -69,3 +69,17 @@ class Command(BaseCommand):
if medium.day:
f.write(f"Jour : {medium.day}\n\n")
f.write("\n\n\n")
# Traitement différent pour les jeux
with open(directory + "/docs/jeux.md", "w") as f:
f.write("# Jeux\n\n\n")
for game in Jeu.objects.order_by("name").all():
f.write(f"## {game.name}\n\n\n")
f.write(f"Durée : {game.duree}\n\n")
f.write(f"Nombre de joueurs : {game.nombre_joueurs_min} - {game.nombre_joueurs_max}\n\n")
if game.proprietaire.username != "Med":
f.write(f"Propriétaire : {game.proprietaire.username}\n\n")
if game.comment:
f.write(f"Commentaire : {game.comment}\n\n")
f.write("\n\n\n")