archiv obrázky u ročníků
This commit is contained in:
parent
732a2273db
commit
33ff9715c9
2 changed files with 5 additions and 13 deletions
|
@ -13,9 +13,9 @@
|
|||
</div>
|
||||
|
||||
<ul>
|
||||
{% for r in object_list %}
|
||||
<li><a href='{{ r.verejne_url }}'>Ročník {{ r }}</a>
|
||||
<img src="{{ object_list.r }}" alt="">
|
||||
{% for rocnik, url_png in object_list.items %}
|
||||
<li><a href='{{ r.verejne_url }}'>Ročník {{ rocnik }}</a>
|
||||
<img src="{{ url_png }}" alt="">
|
||||
{% empty %}
|
||||
Nejsou žádné ročníky
|
||||
{% endfor %}
|
||||
|
|
|
@ -317,15 +317,12 @@ class ArchivView(generic.ListView):
|
|||
# op == os.path, udělá z argumentů cestu
|
||||
png_dir = op.join(settings.MEDIA_ROOT, "cislo", "png")
|
||||
|
||||
# seznam [(url obrázku, číslo)]
|
||||
# slovník {(ročník, url obrázku)}
|
||||
urls ={}
|
||||
|
||||
for i,c in enumerate(cisla):
|
||||
if not c.pdf:
|
||||
urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", "default.png")
|
||||
# urls.append(
|
||||
# (op.join(settings.MEDIA_URL, "cislo", "png", "default.png"), c.rocnik)
|
||||
# )
|
||||
else:
|
||||
filename = os.path.split(c.pdf.file.name)[1].split(".")[0]
|
||||
png_filename = "{}.png".format(filename)
|
||||
|
@ -346,9 +343,6 @@ class ArchivView(generic.ListView):
|
|||
])
|
||||
|
||||
urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", png_filename)
|
||||
#urls.append(
|
||||
#(op.join(settings.MEDIA_URL, "cislo", "png", png_filename), c.rocnik)
|
||||
#)
|
||||
|
||||
context["object_list"] = urls
|
||||
|
||||
|
@ -415,9 +409,7 @@ class ArchivView(generic.ListView):
|
|||
# spirala(urls, tags, 0)
|
||||
|
||||
# context["nahledy"] = "\n".join(tags)
|
||||
print(context)
|
||||
for i in context["object_list"]:
|
||||
print(context["object_list"][i])
|
||||
|
||||
return context
|
||||
|
||||
### Výsledky
|
||||
|
|
Loading…
Reference in a new issue