From 3715583d29374ca8a1d041319385f56431f4e477 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Tue, 27 Nov 2012 19:06:05 -0500 Subject: [PATCH] Implement a command to expunge old UserMessages and Messages from the database (imported from commit a4873dfa8737c483411d12f30daaebebebf859f9) --- zephyr/management/commands/expunge_db.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 zephyr/management/commands/expunge_db.py diff --git a/zephyr/management/commands/expunge_db.py b/zephyr/management/commands/expunge_db.py new file mode 100644 index 0000000000..bbccc364ea --- /dev/null +++ b/zephyr/management/commands/expunge_db.py @@ -0,0 +1,11 @@ +from django.core.management.base import BaseCommand +from zephyr.retention_policy import get_UserMessages_to_expunge +from zephyr.models import Message + +class Command(BaseCommand): + help = ('Expunge old UserMessages and Messages from the database, ' + + 'according to the retention policy.') + + def handle(self, *args, **kwargs): + get_UserMessages_to_expunge().delete() + Message.remove_unreachable()