how to use for loop in django queryset code example
Example: django iterate over all objects
star_set = Star.objects.all()
# The `iterator()` method ensures only a few rows are fetched from
# the database at a time, saving memory.
for star in star_set.iterator():
print(star.name)