more removing of date.today and replacing with timezone.now
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import rules
|
||||
import datetime
|
||||
from django.utils import timezone
|
||||
|
||||
# PERMISSIONS
|
||||
|
||||
@@ -78,7 +79,7 @@ def user_is_not_basic(user):
|
||||
if user.rower.rowerplan != 'basic':
|
||||
return True
|
||||
|
||||
if user.rower.protrialexpires >= datetime.date.today():
|
||||
if user.rower.protrialexpires >= timezone.now().date():
|
||||
return True # pragma: no cover
|
||||
|
||||
return False
|
||||
@@ -143,7 +144,7 @@ def is_protrial(user):
|
||||
return False
|
||||
|
||||
if r.rowerplan == 'basic':
|
||||
return r.protrialexpires >= datetime.date.today()
|
||||
return r.protrialexpires >= timezone.now().date()
|
||||
if r.rowerplan == 'freecoach':
|
||||
if r.mycoachgroup is not None:
|
||||
return len(r.mycoachgroup)>=4
|
||||
@@ -188,7 +189,7 @@ def is_plantrial(user):
|
||||
return False
|
||||
|
||||
if r.rowerplan in ['basic','pro']:
|
||||
return r.plantrialexpires >= datetime.date.today()
|
||||
return r.plantrialexpires >= timezone.now().date()
|
||||
if r.rowerplan == 'freecoach':
|
||||
if r.mycoachgroup is not None:
|
||||
return len(r.mycoachgroup)>=4
|
||||
@@ -211,7 +212,7 @@ def can_plan(user):
|
||||
if user.rower.rowerplan in ['plan','coach']:
|
||||
return True
|
||||
if user.rower.rowerplan in ['basic','pro']:
|
||||
return user.rower.plantrialexpires >= datetime.date.today()
|
||||
return user.rower.plantrialexpires >= timezone.now().date()
|
||||
if user.rower.rowerplan == 'freecoach': # pragma: no cover
|
||||
if user.rower.mycoachgroup is not None:
|
||||
return len(user.rower.mycoachgroup)>=4
|
||||
|
||||
Reference in New Issue
Block a user