i trying start second loop first loop ended. in loop using cell, in both loop. in first loop using if condition. when condition false, came out first loop, , go in second loop, , start cell cell in first loop ended... how that..
i java code following, how same thing in django template.
java code
int i=0; for(;i< arr.length; i++){ if(i<5 && i<arr.length) break; } for(i<arr.length;i++){ }
django template
<tr{{ row.attr_string|safe }}> {% spaceless %} {% cell in row %} {% if forloop.counter < 4 %} {% include "horizon/common/_data_grid_cell.html" %} break {% endif %} {% endfor %} <a href="#" id="example-show" class="showlink" onclick="showhide('example');return false;">see more.</a></p> {% cell in row %} {% include "horizon/common/_data_grid_cell.html" %} {% endfor %} {% endspaceless %} </tr>
you can use {% if forloop.last %}
inside loop check if last item in list.
you cann't break forloop
in django template.
alternatively can use slice.
{% cell in row|slice:"4" %}
for first looop.
Comments
Post a Comment