mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 02:54:20 +00:00
Better way to check if a user is subscriber
This commit is contained in:
parent
6ee1ee365b
commit
33964e0bab
@ -231,8 +231,8 @@ class User(AbstractBaseUser):
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def is_subscribed(self):
|
def is_subscribed(self):
|
||||||
s = self.subscriptions.filter(subscription_start__lte=timezone.now()).order_by('subscription_end').last()
|
s = self.subscriptions.filter(subscription_start__lte=timezone.now(), subscription_end__gte=timezone.now())
|
||||||
return s.is_valid_now() if s is not None else False
|
return s.exists()
|
||||||
|
|
||||||
_club_memberships = {}
|
_club_memberships = {}
|
||||||
_group_names = {}
|
_group_names = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user