Answers for "loop through django object"

1

for loop in django

{% for i in range %}
     ...
{% endfor %}
Posted by: Guest on September-10-2020
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

Python Answers by Framework

Browse Popular Code Answers by Language