X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ca336bd1f9658cf713681d1412d4153e5c4d9c93..68f21622eb28525d849d34df21882714818c95ce:/src/club/helpers.py?ds=sidebyside diff --git a/src/club/helpers.py b/src/club/helpers.py index 4ece5f9ab..728f64aa3 100644 --- a/src/club/helpers.py +++ b/src/club/helpers.py @@ -1,3 +1,6 @@ +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. +# from django.utils.timezone import now from .models import Schedule @@ -5,5 +8,7 @@ from .models import Schedule def get_active_schedule(user): if not user.is_authenticated: return None - return Schedule.objects.filter(membership__user=user, expires_at__gt=now()).first() + return Schedule.objects.filter( + membership__user=user + ).exclude(payed_at=None).exclude(expires_at__lt=now()).first()