forked from DGNum/gestioCOF
Switched from hardcoded settings to config
This commit is contained in:
parent
46242ad2c0
commit
beba3052dd
3 changed files with 13 additions and 11 deletions
|
@ -203,8 +203,3 @@ MAIL_DATA = {
|
||||||
"REPLYTO": "BdA-Revente <bda-revente@ens.fr>",
|
"REPLYTO": "BdA-Revente <bda-revente@ens.fr>",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# Max lookback date into kfet history
|
|
||||||
KFET_HISTORY_DATE_LIMIT = timedelta(weeks=1)
|
|
||||||
# limite plus longue pour les chef/trez
|
|
||||||
KFET_HISTORY_LONG_DATE_LIMIT = timedelta(days=30)
|
|
||||||
|
|
|
@ -482,6 +482,16 @@ class KFetConfigForm(ConfigForm):
|
||||||
label="Durée pour annuler une commande sans mot de passe",
|
label="Durée pour annuler une commande sans mot de passe",
|
||||||
initial=timedelta(minutes=5),
|
initial=timedelta(minutes=5),
|
||||||
)
|
)
|
||||||
|
kfet_history_limit = forms.DurationField(
|
||||||
|
label="Limite de confidentialité de l'historique",
|
||||||
|
initial=timedelta(days=7),
|
||||||
|
help_text="Les éléments plus vieux que cette durée seront masqués",
|
||||||
|
)
|
||||||
|
kfet_history_long_limit = forms.DurationField(
|
||||||
|
label="Limite de confidentialité de l'historique pour chef/trez",
|
||||||
|
initial=timedelta(days=30),
|
||||||
|
help_text="Limite plus longue en cas de problème de compta",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FilterHistoryForm(forms.Form):
|
class FilterHistoryForm(forms.Form):
|
||||||
|
@ -489,10 +499,7 @@ class FilterHistoryForm(forms.Form):
|
||||||
label=_("De"),
|
label=_("De"),
|
||||||
widget=DateTimeWidget,
|
widget=DateTimeWidget,
|
||||||
required=False,
|
required=False,
|
||||||
help_text="Limité à {} jours ({} pour les chefs/trez)".format(
|
help_text="Limité pour raisons de confidentialité",
|
||||||
settings.KFET_HISTORY_DATE_LIMIT.days,
|
|
||||||
settings.KFET_HISTORY_LONG_DATE_LIMIT.days,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
end = forms.DateTimeField(label=_("À"), widget=DateTimeWidget, required=False)
|
end = forms.DateTimeField(label=_("À"), widget=DateTimeWidget, required=False)
|
||||||
checkout = forms.ModelChoiceField(
|
checkout = forms.ModelChoiceField(
|
||||||
|
|
|
@ -1414,8 +1414,8 @@ def cancel_operations(request):
|
||||||
def get_history_limit(user) -> timedelta:
|
def get_history_limit(user) -> timedelta:
|
||||||
"""returns the earliest date the user can view history"""
|
"""returns the earliest date the user can view history"""
|
||||||
if user.has_perm("access_old_history"):
|
if user.has_perm("access_old_history"):
|
||||||
return datetime.today() - settings.KFET_HISTORY_LONG_DATE_LIMIT
|
return datetime.today() - kfet_config.history_long_limit
|
||||||
return datetime.today() - settings.KFET_HISTORY_DATE_LIMIT
|
return datetime.today() - kfet_config.history_limit
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue