Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goutomroy/c85ecf2fd47fd294dd3b5e4b76490c9f to your computer and use it in GitHub Desktop.
Save goutomroy/c85ecf2fd47fd294dd3b5e4b76490c9f to your computer and use it in GitHub Desktop.
# Don't
for entry in Entry.objects.all():
entry.likes += 1
entry.save()
# Do
Entry.objects.update(likes=F('likes') + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment