我已经尝试连接这样的:
{% for choice in choice_dict %}
{% if choice =='2' %}
{% with "mod"|add:forloop.counter|add:".html" as template %}
{% include template %}
{% endwith %}
{% endif %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,我只得到"mod.html"而不是forloop.counter号码.有谁知道发生了什么以及我可以做些什么来解决这个问题?非常感谢!
python django for-loop string-concatenation django-templates