forked from DGNum/gestioCOF
Switched from datetime.today() to timezone.now()
This commit is contained in:
parent
4b95b65be2
commit
9a635148bb
1 changed files with 4 additions and 3 deletions
|
@ -1413,12 +1413,13 @@ def cancel_operations(request):
|
|||
def get_history_limit(user) -> datetime:
|
||||
"""returns the earliest date the given user can view history
|
||||
according to his/her permissions"""
|
||||
now = timezone.now()
|
||||
if user.has_perm("kfet.access_old_history"):
|
||||
return datetime.today() - kfet_config.history_long_limit
|
||||
return now - kfet_config.history_long_limit
|
||||
if user.has_perm("kfet.is_team"):
|
||||
return datetime.today() - kfet_config.history_limit
|
||||
return now - kfet_config.history_limit
|
||||
# should not happen - future earliest date
|
||||
return datetime.today() + timedelta(days=1)
|
||||
return now + timedelta(days=1)
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
Loading…
Reference in a new issue