Created
April 18, 2012 07:00
-
-
Save reedobrien/2411619 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
keepdate = now - timedelta(days=30) | |
number_of_objects = 100 | |
count = FeedLog.objects.filter(created__lte=keepdate).count() | |
for i in xrange(0, count, number_of_objects): | |
smaller_queryset = FeedLog.objects.filter( | |
created__lte=keepdate)[i: i + number_of_objects] | |
for feed_log in smaller_queryset: | |
feed_log.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment