mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-26 05:42:23 +00:00
Revues are treated separately
This commit is contained in:
parent
cb9cd8f9b6
commit
be2094b263
@ -17,8 +17,10 @@ class Command(BaseCommand):
|
|||||||
directory = options["directory"]
|
directory = options["directory"]
|
||||||
|
|
||||||
for model_class, file_name in [(BD, "bd.md"), (Manga, "mangas.md"), (Roman, "romans.md"),
|
for model_class, file_name in [(BD, "bd.md"), (Manga, "mangas.md"), (Roman, "romans.md"),
|
||||||
(CD, "cd.md"), (Vinyle, "vinyle.md"), (Revue, "revues.md")]:
|
(CD, "cd.md"), (Vinyle, "vinyle.md")]:
|
||||||
with open(directory + "/docs/" + file_name, "w") as f:
|
with open(directory + "/docs/" + file_name, "w") as f:
|
||||||
|
f.write("# " + model_class.Meta.verbose_name)
|
||||||
|
|
||||||
titles = list(set(obj["title"] for obj in model_class.objects.values("title").distinct().all()))
|
titles = list(set(obj["title"] for obj in model_class.objects.values("title").distinct().all()))
|
||||||
titles.sort()
|
titles.sort()
|
||||||
|
|
||||||
@ -41,3 +43,25 @@ class Command(BaseCommand):
|
|||||||
if hasattr(medium, "external_url"):
|
if hasattr(medium, "external_url"):
|
||||||
f.write(f"Lien : [{medium.external_url}]({medium.external_url})\n\n")
|
f.write(f"Lien : [{medium.external_url}]({medium.external_url})\n\n")
|
||||||
f.write("\n\n\n")
|
f.write("\n\n\n")
|
||||||
|
|
||||||
|
# Traitement différent pour les revues
|
||||||
|
with open(directory + "/docs/revues.md", "w") as f:
|
||||||
|
f.write("# Revues")
|
||||||
|
|
||||||
|
titles = list(set(obj["title"] for obj in Revue.objects.values("title").distinct().all()))
|
||||||
|
titles.sort()
|
||||||
|
|
||||||
|
for title in titles:
|
||||||
|
f.write(f"## {title}\n\n\n")
|
||||||
|
|
||||||
|
for medium in Revue.objects.filter(title=title).order_by("number").all():
|
||||||
|
f.write(f"### Numéro {medium.number}\n\n\n")
|
||||||
|
if medium.double:
|
||||||
|
f.write("Double revue\n\n")
|
||||||
|
if medium.year:
|
||||||
|
f.write(f"Année : {medium.year}\n\n")
|
||||||
|
if medium.month:
|
||||||
|
f.write(f"Mois : {medium.month}\n\n")
|
||||||
|
if medium.day:
|
||||||
|
f.write(f"Jour : {medium.day}\n\n")
|
||||||
|
f.write("\n\n\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user