I have 2 seperate forloops and i am using forloop.counter in bothloops. I want to start the second forloop counter from the ending of first forloop
{% for i in something1 %}
<tr>
<td>{{ forloop.counter }}</td>
<td>i.username</td>
</tr>
{% endfor %}
{% for j in something2 %}
<tr>
<td>{{ forloop.counter }}</td>
<td>j.username</td>
</tr>
{% endfor %}
if the first forloop ends at 10 then i want to start the next for loop from 11.plz help
I'm not comfortable with Django, so I show a couple of option in plain Python, given the collections:
You can access objects by index (not the same as database index):
Or slice the last collection:
Of course, the last collection has to be the longest.
Python's slicing features are quite extensive.
the syntax looks like that:
SOME_STRING[start:stop:step]
.So basically you can use it pretty much however you like.
I wanted to comment it on your comment, but unfortunately I don't have enough rep :)