Answers for "django iterate over all objects"

0

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)
Posted by: Guest on August-31-2020

Code answers related to "django iterate over all objects"

Python Answers by Framework

Browse Popular Code Answers by Language