I have a QuerySet, let\'s call it qs, which is ordered by some attribute which is irrelevant to this problem. Then I have an object, let\'s call it obj
qs
obj
Compact and probably the most efficient:
for index, item in enumerate(your_queryset): ...