S
S
sportik1742020-12-20 11:45:18
Django
sportik174, 2020-12-20 11:45:18

How to concatenate in a Django template?

How to concatenate in a Django template?
This is how it doesn't work:

{% static 'main/img/flags/' + collection.fabrika.country + '.jpg' %}


The collection.fabrika.country variable stores just a string with the name of the country, for example "Russia".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2020-12-20
@sportik174

{% with "shop/"|add:shop_name|add:"/base.html" as var1 %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question