Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goutomroy/ea5cf25e875cbc06483b743b7e6dd983 to your computer and use it in GitHub Desktop.
Save goutomroy/ea5cf25e875cbc06483b743b7e6dd983 to your computer and use it in GitHub Desktop.
queryset = Entry.objects.all()
lst = list(queryset)
# returns a list of entry objects
first_ten = queryset[:10]
# list slicing not queryset slicing because first_ten is a list.
first_five = first_ten[:5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment