由于django模板中没有模数(%)所以如何在此应用循环
{% for story in data %}
{{forloop.counter}}
当 forloop.counter%4==1 那么这应该被执行
<div class="thumb">
<a href="#"><img src="{{ STATIC_URL }}images/thumb.jpg" width="185" height="185" /></a>
</div>
<div class="thumbFooter">
<span class="view">
<a href="#" class="viewIcon">{{ story.views }}</a>
</span>
<span class="like">
<a href="#" class="likeIcon">{{ story.likes }}</a>
</span>
</div>
</li>
当 forloop.counter%4==2 或 3 那么这个
<li>
<div class="thumb">
<a href="#"><img src="{{ STATIC_URL }}images/thumb.jpg" width="185" height="185" /></a>
</div>
<div class="thumbFooter">
<span class="view">
<a href="#" class="viewIcon">{{ story.views }}</a>
</span>
<span class="like">
<a href="#" class="likeIcon">{{ story.likes }}</a>
</span>
</div>
</li>
当 forloop.counter%4==0 的 for 循环时,应该执行
<li class="omega">
<div class="thumb">
<a href="#"><img src="{{ STATIC_URL }}images/thumb.jpg" width="185" height="185" /></a>
</div>
<div class="thumbFooter">
<span class="view">
<a href="#" class="viewIcon">{{ story.views }}</a>
</span>
<span class="like">
<a href="#" class="likeIcon">{{ story.likes }}</a>
</span>
</div>
</li>
<div class="clear"></div>
{% endfor %}