如何在django中获取下一个对象进行循环?
我的意思是可以这样做{{ route.segments.all.ind }}
吗?
{% for segment in route.segments.all %}
{% if segment.departure == departure %}
{% with forloop.counter as ind %}
<span style="margin-top: -5px; font-size: smaller">
$ {{ route.segments.all.ind }}
{{ segment.distance }}km
{{ segment.duration }}hour</span>
{%endwith %}
{% endif %}
{% endfor %}