What you are trying to do is very unusual, and any solution to exactly what you
are asking is going to be an ugly hack. So, why do you want to do this? What are
these static files that you have in mylist?
On 16/06/2022 14.09, luca72.b...@gmail.com wrote:
Hello i have a list like:
mylist = ['1,png','2.png',3.jpj']
in the template i do as follow:
{% for o in mylist %}
<ul>
{% if "png" in o %}
{{ o }}
<li><img width="770" height="1500" alt="" src="{% static "polls/{{o}}"
%}" class=""></li>
{% else %}
<li>{{o}}</li>
</ul>
{% endif %}
{% endfor %}
in the template i see the file name but it never render, if i loock the source
code i see that in the <img tag i have this line
<li><img width="770" height="1500" alt="" src="/static_files/polls/%7Bo%7D
<http://127.0.0.1:8000/static_files/polls/%7Bo%7D>" class=""></li>
So i never get the correct file name.
How is the correct way to get the name of the variable o inside the img tag
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/b7e47034-7029-476a-bb08-a5e780c4b95bn%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/b7e47034-7029-476a-bb08-a5e780c4b95bn%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/c04b166c-e738-f489-47d2-b89ed5b01f57%40antonischristofides.com.