About Iterating through QuerySets

To get an index of each item in a QuerySet, use enumerate() when iterating:

for index1, item in enumerate(queryset, start=1):
    print(f"{index1}. {item.title}")

Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2 Python 3