1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.utils.timezone import now
5 from .models import Schedule
8 def get_active_schedule(user):
9 if not user.is_authenticated:
11 return Schedule.objects.filter(
13 ).exclude(payed_at=None).exclude(expires_at__lt=now()).first()