1👍
✅
You can manually control index as follows:
index = 0
for link in context["object_list"]:
if link.publicreply_set.exists():
...
index += 1
You can omit the final else
. The point is you manually increment index only when you want to.
Source:stackexchange.com