mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-08-19 21:53:41 +00:00
Fluidifie le code
This commit is contained in:
parent
64f035ec4b
commit
b03e37e7e6
2 changed files with 20 additions and 7 deletions
|
@ -1,10 +1,11 @@
|
|||
{% for key, stats in stats_list.items %}
|
||||
{% for key_dict, stats_dict in stats_list.items %}
|
||||
{% for key, stats in stats_dict.items %}
|
||||
<table class="table table-striped">
|
||||
<h4>Statistiques par utilisateur de {{ key }}</h4>
|
||||
<h4>Statistiques par {{ key_dict }} de {{ key }}</h4>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Utilisateur</th>
|
||||
<th>Nombre d'objets de l'utilisateur</th>
|
||||
<th>{{ key_dict }}</th>
|
||||
<th>Nombre de {{ key }} par {{ key_dict }}</th>
|
||||
<th>Rang</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -17,3 +18,4 @@
|
|||
{% endfor %}
|
||||
</table>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -106,13 +106,22 @@ def stats_models(request):
|
|||
@permission_required('cableur')
|
||||
def stats_users(request):
|
||||
stats = {
|
||||
'Utilisateur' : {
|
||||
'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],
|
||||
'Etablissements' : School.objects.annotate(num=Count('user')).order_by('-num')[:10],
|
||||
'Moyen de paiment' : Paiement.objects.annotate(num=Count('facture')).order_by('-num')[:10],
|
||||
'Banque' : Banque.objects.annotate(num=Count('facture')).order_by('-num')[:10],
|
||||
'Droits' : User.objects.annotate(num=Count('right')).order_by('-num')[:10],
|
||||
},
|
||||
'Etablissement' : {
|
||||
'Utilisateur' : School.objects.annotate(num=Count('user')).order_by('-num')[:10],
|
||||
},
|
||||
'Moyen de paiement' : {
|
||||
'Utilisateur' : Paiement.objects.annotate(num=Count('facture')).order_by('-num')[:10],
|
||||
},
|
||||
'Banque' : {
|
||||
'Utilisateur' : Banque.objects.annotate(num=Count('facture')).order_by('-num')[:10],
|
||||
},
|
||||
}
|
||||
return render(request, 'logs/stats_users.html', {'stats_list': stats})
|
||||
|
||||
|
@ -120,6 +129,8 @@ def stats_users(request):
|
|||
@permission_required('cableur')
|
||||
def stats_actions(request):
|
||||
stats = {
|
||||
'Utilisateur' : {
|
||||
'Action' : User.objects.annotate(num=Count('revision')).order_by('-num')[:40],
|
||||
},
|
||||
}
|
||||
return render(request, 'logs/stats_users.html', {'stats_list': stats})
|
||||
|
|
Loading…
Reference in a new issue