2
我有一個三列表(列1 & 3將顯示圖像)。我使用forloop循環遍歷模板中的對象列表。強制移動到django模板中的for循環內的下一條記錄
在循環內,我想迫使forloop轉到下一個項目,所以第三列中的項目是下一個記錄。我在django文檔中看不到'forloop.next'。
{% for item in object_list %}<tr>
<td><a href="{{ item.url }}"><img src="{{ MEDIA_URL }}{{ item.image }}" width="300" height="100" /></a></td>
<td> </td>
<td><a href="{{ item.url }}"><img src="{{ MEDIA_URL }}{{ item.image }}" width="300" height="100" /></a></td>
</tr>
{% endfor %}<tr>
完成此操作的最佳方法是什麼?
謝謝。正是我需要的。 – zio 2011-12-14 21:48:08