What I use when I want to concatenate strings in Django templates from variables (examples taken from my own code, tell me if you need something closer to your case):
<html> <input id="myid_{{idBase}}_{{idFinal}}" type="checkbox"></input> </html>
and inside the django tag I use the keyword "add" associated with keywork with
{% with 'images/'|add:file_name as image_static %} <img src="{% static image_static %}" title = "{{ tooltip }}" alt = "{{ title }}"/> {% endwith %}
Julien greard
source share