Layout fixes, cover update for files.
[wolnelektury.git] / src / club / management / commands / prolong.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 Schedule
9
10
11 class Command(BaseCommand):
12     def handle(self, *args, **options):
13         for s in Schedule.objects.exclude(monthly=False, yearly=False).filter(is_cancelled=False, expires_at__lt=now() + timedelta(1)):
14             print(s, s.email, s.expires_at)
15             try:
16                 s.pay(None)
17             except:
18                 traceback.print_exc()
19
20