1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-04-28 18:52:40 +00:00

Compare commits

..

No commits in common. "4de83344a7ce13cefeb0d6588d746a2a81e39452" and "6abbaaf75d068747a3ed222e9d56a4ba4bd7933e" have entirely different histories.

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, Jeu
from media.models import BD, CD, Manga, Revue, Roman, Vinyle
class Command(BaseCommand):
@ -16,14 +16,10 @@ class Command(BaseCommand):
def handle(self, *args, **options):
directory = options["directory"]
with open(directory + "/docs/index.md", "w") as f:
f.write("# Media de la Mediatek\n\n\n")
f.write("Ce site répertorie l'intégralité des media présents à la Mediatek de l'ENS Paris-Saclay.\n")
for model_class, file_name in [(BD, "bd.md"), (Manga, "mangas.md"), (Roman, "romans.md"),
(CD, "cd.md"), (Vinyle, "vinyles.md")]:
(CD, "cd.md"), (Vinyle, "vinyle.md")]:
with open(directory + "/docs/" + file_name, "w") as f:
f.write("# " + str(model_class._meta.verbose_name_plural).capitalize() + "\n\n\n")
f.write("# " + str(model_class._meta.verbose_name) + "\n\n\n")
titles = list(set(obj["title"] for obj in model_class.objects.values("title").distinct().all()))
titles.sort()
@ -69,17 +65,3 @@ 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")