forked from DGNum/gestioCOF
Fixed stupid errors
This commit is contained in:
parent
beba3052dd
commit
884ec2535b
2 changed files with 8 additions and 6 deletions
|
@ -2,7 +2,6 @@ from datetime import timedelta
|
|||
from decimal import Decimal
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import validators
|
||||
from django.core.exceptions import ValidationError
|
||||
|
|
|
@ -6,7 +6,6 @@ from decimal import Decimal
|
|||
from typing import List
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
|
@ -1411,11 +1410,15 @@ def cancel_operations(request):
|
|||
return JsonResponse(data)
|
||||
|
||||
|
||||
def get_history_limit(user) -> timedelta:
|
||||
"""returns the earliest date the user can view history"""
|
||||
if user.has_perm("access_old_history"):
|
||||
def get_history_limit(user) -> datetime:
|
||||
"""returns the earliest date the given user can view history
|
||||
according to his/her permissions"""
|
||||
if user.has_perm("kfet.access_old_history"):
|
||||
return datetime.today() - kfet_config.history_long_limit
|
||||
if user.has_perm("kfet.is_team"):
|
||||
return datetime.today() - kfet_config.history_limit
|
||||
# should not happen - future earliest date
|
||||
return datetime.today() + timedelta(days=1)
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
Loading…
Reference in a new issue