Fixes #3934: Error on OAI-PMH list request.
[wolnelektury.git] / src / club / helpers.py
1 from django.utils.timezone import now
2 from .models import Schedule
3
4
5 def get_active_schedule(user):
6     if not user.is_authenticated:
7         return None
8     return Schedule.objects.filter(membership__user=user, is_active=True).exclude(expires_at__lt=now()).first()
9