From 6c54d582ede400bb7d4961cadfe0ac69e23a3915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Mon, 5 Sep 2016 14:39:31 +0200 Subject: [PATCH] =?UTF-8?q?Limite=20de=20l'historique=20charg=C3=A9=20sur?= =?UTF-8?q?=20K-Psul?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kfet/templates/kfet/kpsul.html | 1 + kfet/views.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 3ac32345..b5f768eb 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -959,6 +959,7 @@ $(document).ready(function() { function getHistory() { var data = { from: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), + limit: 100, }; $.ajax({ dataType: "json", diff --git a/kfet/views.py b/kfet/views.py index d0bc54fb..05eb1d16 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -1248,6 +1248,7 @@ def history_json(request): # Récupération des paramètres from_date = request.POST.get('from', None) to_date = request.POST.get('to', None) + limit = request.POST.get('limit', None); checkouts = request.POST.getlist('checkouts[]', None) accounts = request.POST.getlist('accounts[]', None) @@ -1274,6 +1275,9 @@ def history_json(request): # Un non-membre de l'équipe n'a que accès à son historique if not request.user.has_perm('kfet.is_team'): opegroups = opegroups.filter(on_acc=request.user.profile.account_kfet) + if limit: + opegroups = opegroups[:limit] + # Construction de la réponse opegroups_list = []