[Django]-Django iterate on static files in template

7👍

✅

You’re overcomplicating things.

All the static tag does is concatenate the value of settings.STATIC_URL with the filename. You can more easily do that yourself:

  {% get_static_prefix as STATIC_URL %}

  {% for iter in array %}
        <td><img src="{{ STATIC_URL }}{{ iter }}.png" alt=""></td>
  {% endfor %}

Leave a comment