Last active
June 7, 2019 22:51
-
-
Save goutomroy/65460b2877c2b151ea1e02d1b77e9240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Don't.Delete one by one. | |
for entry in Entry.objects.all(): | |
entry.delete() | |
# Do.Delete all at once. | |
Entry.objects.all().delete() | |
# 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