Mercurial > public > sg101
comparison gpp/messages/management/commands/purge_messages.py @ 1:dbd703f7d63a
Initial import of sg101 stuff from private repository.
author | gremmie |
---|---|
date | Mon, 06 Apr 2009 02:43:12 +0000 |
parents | |
children | 5171a5e9353b |
comparison
equal
deleted
inserted
replaced
0:900ba3c7b765 | 1:dbd703f7d63a |
---|---|
1 """ | |
2 purge_messages is a custom manage.py command for the messages application. | |
3 It is intended to be called from a cron job to purge messages that have been | |
4 deleted by both sender and receiver. | |
5 """ | |
6 | |
7 from django.core.management.base import NoArgsCommand | |
8 | |
9 from messages.models import Message | |
10 | |
11 | |
12 class Command(NoArgsCommand): | |
13 help = "Delete messages that have been sent to the trash by both sender and receiver." | |
14 | |
15 def handle_noargs(self, **options): | |
16 Message.objects.filter(sender_delete_date__isnull=False, | |
17 receiver_delete_date__isnull=False).delete() | |
18 | |
19 | |
20 # vim: ts=4 sw=4 |