There are probably 3 ways you can do this:

1) Use a Filter 
<http://chrisbartos.com/articles/use-a-template-filter-to-nest-a-context-variable-inside-of-a-staticfile-template-tag/>
 
You should be able to use the "add" filter to concatenate two strings. 

2) Map the elements of your array in your view with the contents of 
settings.STATIC_URL. 

3) You can't nest a context variable inside another tag like you're trying 
to do but you can concatenate two variables together:

{% static 'my_app' %}/{{filename}}

I hope that helps.

On Wednesday, March 2, 2016 at 5:41:37 AM UTC-5, luca72 wrote:
>
> Hello i have write this in a template:
> {% for a in lista %}
>             <img src="{% static "mysite/scorr/{{a}}" %}" width="100" 
> height="100" </img> 
>  {% endfor %}
> But i get no image
>
> if i add just a <p> {{a}} </> i see that the file name is righ, 
> also if i direct write the file i get it
>  {% for a in lista %}
>             <img src="{% static "mysite/scorr/myfile.jpg" %}" width="100" 
> height="100" </img> 
>  {% endfor %}
>
> can you tell me what is wrong
>
> 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ecc28ce3-bc33-4beb-9063-53335dee7102%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to