From edfd908eb9822d16e8deffbff448af3e4562d93b Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Mon, 21 Nov 2016 03:32:52 +0100 Subject: [PATCH] Repare logs/stats --- logs/templates/logs/aff_stats_users.html | 5 ----- logs/views.py | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/logs/templates/logs/aff_stats_users.html b/logs/templates/logs/aff_stats_users.html index e8914f51..46994192 100644 --- a/logs/templates/logs/aff_stats_users.html +++ b/logs/templates/logs/aff_stats_users.html @@ -1,8 +1,3 @@ - - {% for key_dict, stats_dict in stats_list.items %} {% for key, stats in stats_dict.items %} diff --git a/logs/views.py b/logs/views.py index 82fc464b..4d5c7f9c 100644 --- a/logs/views.py +++ b/logs/views.py @@ -126,9 +126,9 @@ def stats_users(request): start_date = timezone.now() + relativedelta(months=-search_field[1]) stats = { 'Utilisateur' : { - 'Machines' : User.objects.filter(registered__gt=search_field[1]).annotate(num=Count('machine')).order_by('-num')[:10], - 'Facture' : User.objects.filter(registered__gt=search_field[1]).annotate(num=Count('facture')).order_by('-num')[:10], - 'Bannissement' : User.objects.filter(registered__gt=search_field[1]).annotate(num=Count('ban')).order_by('-num')[:10], + 'Machines' : User.objects.annotate(num=Count('machine')).order_by('-num')[:10], + 'Facture' : User.objects.annotate(num=Count('facture')).order_by('-num')[:10], + 'Bannissement' : User.objects.annotate(num=Count('ban')).order_by('-num')[:10], 'Accès gracieux' : User.objects.annotate(num=Count('whitelist')).order_by('-num')[:10], 'Droits' : User.objects.annotate(num=Count('right')).order_by('-num')[:10], },