Skip to content
Snippets Groups Projects
Commit 07bc7e50 authored by HeJ's avatar HeJ
Browse files

housekeeping: do voucher auto-assignments

parent 45a48df6
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ from django.core.management.base import BaseCommand ...@@ -2,6 +2,7 @@ from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
from ...models.messages import DirectMessage from ...models.messages import DirectMessage
from ...models.voucher import Voucher
class Command(BaseCommand): class Command(BaseCommand):
...@@ -9,3 +10,7 @@ class Command(BaseCommand): ...@@ -9,3 +10,7 @@ class Command(BaseCommand):
# clear all direct messages which are after their expiry date # clear all direct messages which are after their expiry date
deleted_msgs_count, _ = DirectMessage.objects.filter(autodelete_after__isnull=False, autodelete_after__lte=timezone.now()).delete() deleted_msgs_count, _ = DirectMessage.objects.filter(autodelete_after__isnull=False, autodelete_after__lte=timezone.now()).delete()
print(f'Deleted {deleted_msgs_count} messages.') print(f'Deleted {deleted_msgs_count} messages.')
# do auto-assignments
vouchers_assigned = Voucher.do_auto_assignments()
print(f'Auto-assigned {vouchers_assigned} vouchers.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment