I am trying to get all image link present in a folder. Currently, I am assigning the link manually. But, I want my django to get all images from a specific folder irrespective of their names.
<li>
<a href="{% static "styles/jamia/1.jpg" %}" rel="prettyPhoto[gallery1]"><img src="{% static "styles/jamia/1.jpg" %}"></a>
</li>
<li>
<a href="{% static "styles/jamia/2.jpg" %}" rel="prettyPhoto[gallery1]"><img src="{% static "styles/jamia/2.jpg" %}"></a>
</li>
I am looking for something like:
{% for file in {% static "styles/jamia/" %} %}
<img src="{{file}}" alt="">
{% endfor %}
All images are present in jamia
folder.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…