This doesn't make sense at all - if you want a variable in the static call
you need to do something like this:
{% with 'icons/'|add:newspaper|add:'.png' as image_static %}
{% static image_static %}{% endwith %}
The reason for not just adding it to the end is because you could have md5
hashes in your static file as well. So therefore this is the best way to do
it.
Regards,
Andréas
Den tors 2 maj 2019 kl 15:45 skrev Nelson Varela <[email protected]
>:
> I think you can not render variable in a template tag, so:
>
> {% static "/icons/{{newspaper}}.png" %}
>
> maybe should be
>
> {% static "/icons/" %}{{newspaper}}.png
>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/4f2a0b3a-ab7c-46b2-8fdd-020c2bf8fd2e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4f2a0b3a-ab7c-46b2-8fdd-020c2bf8fd2e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/CAK4qSCf2ZvyVSKrVLxCc1Yqs_eRiNwSwPP9W_NWnq_Kf3gymEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.