Limite le datepicker pour ne pas demander plus de temps que possible dans l'historique

This commit is contained in:
Tom Hubrecht 2021-02-10 22:13:50 +01:00
parent fbafdb7134
commit 559b36b6f0
2 changed files with 7 additions and 1 deletions

View file

@ -62,6 +62,7 @@ $(document).ready(function() {
format : 'YYYY-MM-DD HH:mm', format : 'YYYY-MM-DD HH:mm',
stepping : 5, stepping : 5,
locale : 'fr', locale : 'fr',
minDate : '{{ week_ago }}',
showTodayButton: true, showTodayButton: true,
widgetPositioning: { widgetPositioning: {
horizontal: "left", horizontal: "left",

View file

@ -1588,7 +1588,12 @@ def kpsul_articles_data(request):
@teamkfet_required @teamkfet_required
def history(request): def history(request):
data = {"filter_form": FilterHistoryForm()} week_ago = timezone.now() - settings.KFET_HISTORY_DATE_LIMIT
data = {
"filter_form": FilterHistoryForm(),
"week_ago": week_ago.strftime("%Y-%m-%d %H:%M"),
}
print(data["week_ago"])
return render(request, "kfet/history.html", data) return render(request, "kfet/history.html", data)