【发布时间】:2011-11-25 14:02:21
【问题描述】:
我需要在Django模板中输出对象,这样每个对象都有自己的模板。模板保存在变量“模板”中 - ['path/to/template1','path/to/template2', ...]
有没有办法在对象循环中“循环”这些模板,就像这样:
{% for object in objects %}
{% cycle templates as template %}
{% include template %} // this code is just for example
{% endfor %}
我不能将这些模板直接包含到对象列表中,因为它是由分页器的模板标签生成的。
有什么想法吗?谢谢。
【问题讨论】:
标签: django templates include cycle