From 33964e0babbef0beb18effd08c7ed89a2faaf632 Mon Sep 17 00:00:00 2001 From: Krophil Date: Wed, 15 Nov 2017 16:46:43 +0100 Subject: [PATCH] Better way to check if a user is subscriber --- core/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/models.py b/core/models.py index 7cae151b..31facaea 100644 --- a/core/models.py +++ b/core/models.py @@ -231,8 +231,8 @@ class User(AbstractBaseUser): @cached_property def is_subscribed(self): - s = self.subscriptions.filter(subscription_start__lte=timezone.now()).order_by('subscription_end').last() - return s.is_valid_now() if s is not None else False + s = self.subscriptions.filter(subscription_start__lte=timezone.now(), subscription_end__gte=timezone.now()) + return s.exists() _club_memberships = {} _group_names = {}