【发布时间】:2011-10-20 20:03:54
【问题描述】:
我有一个奇怪的问题。
我使用分页器在每个页面中显示一些数据,但是,我看不到任何向模型添加我需要的其他属性的可能性,因此我创建了另一个包含其他数据的字典列表。
在模板中:
{% for x in p.object_list %}
{% with c=forloop.counter0 %} {{ info.c }} <!-- prints nothing, while {{ info }} prints all the list of dicts and {{ c }} prints 0, for example. {{ info.0 }} prints everything as intended too. --> {% endwith %}{% endfor %}
【问题讨论】:
标签: django templates variables