Dynamic use of templates in Jinja2 Dynamic use of templates in Jinja2 flask flask

Dynamic use of templates in Jinja2


If anyone needs it:

{% for d in dicts %}  {% set template = d.type + '.html' %} {% include template %}{% endfor %}

then in the template you can access the content like so:

{{ d.content }}

Thanks to donri from the #pocoo channel on freenode !