Re: variable inside a template

2022-06-16 Thread Antonis Christofides
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 =  ['

Re: variable inside a template

2022-06-16 Thread Larry Martell
On Thu, Jun 16, 2022 at 4:09 AM 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 %} > > {% if "png" in o %} > {{ o }} > > {% else %} > {{o}} >

Re: variable inside a template

2022-06-16 Thread Sencer Hamarat
Don use 'o' as a template variable in the template function Use {% static 'poll/'|add:o %} instead. 16 Haz 2022 Per 14:09 tarihinde luca72.b...@gmail.com < luca72.bertolo...@gmail.com> şunu yazdı: > Hello i have a list like: > mylist = ['1,png','2.png',3.jpj'] > in the template i do as follow:

variable inside a template

2022-06-16 Thread luca72.b...@gmail.com
Hello i have a list like: mylist = ['1,png','2.png',3.jpj'] in the template i do as follow: {% for o in mylist %} {% if "png" in o %} {{ o }} {% else %} {{o}} {% endif %} {% endfor %} in the template i see the file name