[Answered ]-Django: Is it possible to get field values for a list of objects in bulk?

1👍

If listOfOtherVotes is a QuerySet, you can use .select_related(…) [Django-doc] to make a LEFT OUTER JOIN in the query, and thus fetch the details of the related .movies in the same query, thus avoiding to fetch each .movie with an extra query:

for otherVote in listOfOtherVotes.select_related('movie'):
    # …
    movie = otherVote.movie
    # …

Leave a comment