Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goutomroy/6e80256343ab5bee989d30ae9221006c to your computer and use it in GitHub Desktop.
Save goutomroy/6e80256343ab5bee989d30ae9221006c to your computer and use it in GitHub Desktop.
queryset = Entry.objects.all()
# Queries the database because queryset hasn't been evaluated yet.
print(queryset[5])
# Queries the database because queryset hasn't been evaluated yet.
print(queryset[5])
lst = list(queryset)
# Using caches because evaluation happened in previous list().
print(queryset[5])
print(queryset[10])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment