e461b6854e7ec798758cd962e4b4b0cc9b8e5a33
[wolnelektury.git] / src / club / management / commands / send_receipts.py
1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from datetime import timedelta
5 import traceback
6 from django.core.management.base import BaseCommand, CommandError
7 from django.utils.timezone import now
8 from club.models import PayUOrder
9
10
11 class Command(BaseCommand):
12     def handle(self, *args, **options):
13         year = 2019
14         for email in PayUOrder.objects.filter(completed_at__year=2019).order_by('schedule__email').values_list('schedule__email', flat=True).distinct():
15             print(email)
16             PayUOrder.send_receipt(email, year)