Created
January 13, 2015 17:12
-
-
Save narenaryan/a8de0f7e08e389a158de to your computer and use it in GitHub Desktop.
Snippet for deleting the duplicate entrys for a model
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
for row in MyModel.objects.all(): | |
if MyModel.objects.filter(photo_id=row.photo_id).count() > 1: | |
row.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment