0

How can I implement addition object variable in static block, for example:

<script src="{% static 'base/js/{{obj.id}}_container.js' %}"></script>

How to make it works?

  • Does this answer your question? [load static file with variable name in django](https://stackoverflow.com/questions/18040941/load-static-file-with-variable-name-in-django) – Brian61354270 Feb 12 '23 at 19:37

1 Answers1

0

I have found a solution:

{%with obj.id|slugify as id%}

<script src="{% static 'base/js/'|add:id|add:'_container.js'%}"></script>

and it works.