mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-25 05:42:24 +00:00
Buggy markdown
This commit is contained in:
parent
9afb750be6
commit
6abbaaf75d
@ -19,7 +19,7 @@ class Command(BaseCommand):
|
||||
for model_class, file_name in [(BD, "bd.md"), (Manga, "mangas.md"), (Roman, "romans.md"),
|
||||
(CD, "cd.md"), (Vinyle, "vinyle.md")]:
|
||||
with open(directory + "/docs/" + file_name, "w") as f:
|
||||
f.write("# " + str(model_class._meta.verbose_name))
|
||||
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()
|
||||
@ -27,26 +27,26 @@ class Command(BaseCommand):
|
||||
for title in titles:
|
||||
f.write(f"## {title}\n\n\n")
|
||||
|
||||
for medium in model_class.objects.filter(title=title).order_by("side_identifier").all():
|
||||
if hasattr(medium, "subtitle"):
|
||||
f.write(f"### {medium.subtitle}\n\n\n")
|
||||
if hasattr(medium, "isbn"):
|
||||
f.write(f"ISBN : {medium.isbn}\n\n")
|
||||
f.write(f"Cote : {medium.side_identifier}\n\n")
|
||||
f.write("Auteurs : " + ", ".join(author.name for author in medium.authors.all()) + "\n\n")
|
||||
if hasattr(medium, "number_of_pages"):
|
||||
f.write(f"Nombre de pages : {medium.number_of_pages}\n\n")
|
||||
if hasattr(medium, "rpm"):
|
||||
f.write(f"Tours par minute : {medium.rpm}\n\n")
|
||||
if hasattr(medium, "publish_date"):
|
||||
f.write(f"Publié le : {medium.publish_date}\n\n")
|
||||
if hasattr(medium, "external_url"):
|
||||
f.write(f"Lien : [{medium.external_url}]({medium.external_url})\n\n")
|
||||
f.write("\n\n\n")
|
||||
for medium in model_class.objects.filter(title=title).order_by("side_identifier").all():
|
||||
if hasattr(medium, "subtitle"):
|
||||
f.write(f"### {medium.subtitle}\n\n\n")
|
||||
if hasattr(medium, "isbn"):
|
||||
f.write(f"ISBN : {medium.isbn}\n\n")
|
||||
f.write(f"Cote : {medium.side_identifier}\n\n")
|
||||
f.write("Auteurs : " + ", ".join(author.name for author in medium.authors.all()) + "\n\n")
|
||||
if hasattr(medium, "number_of_pages"):
|
||||
f.write(f"Nombre de pages : {medium.number_of_pages}\n\n")
|
||||
if hasattr(medium, "rpm"):
|
||||
f.write(f"Tours par minute : {medium.rpm}\n\n")
|
||||
if hasattr(medium, "publish_date"):
|
||||
f.write(f"Publié le : {medium.publish_date}\n\n")
|
||||
if hasattr(medium, "external_url"):
|
||||
f.write(f"Lien : [{medium.external_url}]({medium.external_url})\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")
|
||||
f.write("# Revues\n\n\n")
|
||||
|
||||
titles = list(set(obj["title"] for obj in Revue.objects.values("title").distinct().all()))
|
||||
titles.sort()
|
||||
|
Loading…
Reference in New Issue
Block a user