django iterate objects 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)