mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
finalisation de la page de gestion des droits
This commit is contained in:
parent
40c1d078a4
commit
fd35836f47
2 changed files with 73 additions and 84 deletions
|
@ -25,86 +25,58 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
|
||||||
<div class="panel-group" id="accordion">
|
{% for droit,users in stats_list.items %}
|
||||||
{% for droit in stats_list %}
|
<div class="panel panel-default">
|
||||||
<div class="panel panel-default">
|
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse{{droit.id}}">
|
||||||
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse{{droit.id}}">
|
<h2 class="panel-title pull-left">
|
||||||
<h2 class="panel-title pull-left">
|
<i class="fa fa-address-book"></i>
|
||||||
<i class="fa fa-address-book"></i>
|
{{droit}}
|
||||||
{{droit}}
|
<span class="badge">{{users.count}}</span>
|
||||||
<span class="badge">{{droit.user_set.all.count}}</span>
|
</h2>
|
||||||
</h2>
|
</div>
|
||||||
|
<div class="panel-collapse collapse" id="collapse{{droit.id}}">
|
||||||
</div>
|
<div class="panel-body">
|
||||||
<div class="panel-collapse collapse" id="collapse{{droit.id}}">
|
<div class="table-responsive">
|
||||||
<div class="panel-body">
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
<div class="table-responsive">
|
<tr>
|
||||||
<table class="table table-striped">
|
<th>Pseudo</th>
|
||||||
<thead>
|
<th>Adhésion</th>
|
||||||
<tr>
|
<th>Derniere connexion</th>
|
||||||
<th>Pseudo</th>
|
<th>Nombre d'actions</th>
|
||||||
<th>Adhésion</th>
|
<th>Date de la dernière action</th>
|
||||||
<th>Derniere connection</th>
|
<th></th>
|
||||||
<th>Nombre d'actions</th>
|
</tr>
|
||||||
<th>Supprimer </th>
|
</thead>
|
||||||
</tr>
|
{% for utilisateur in users %}
|
||||||
</thead>
|
<tr>
|
||||||
{% for user in droit.user_set.all %}
|
<td>{{ utilisateur.pseudo }}</td>
|
||||||
<tr>
|
{% if utilisateur.is_adherent %}
|
||||||
<td>{{ user.pseudo }}</td>
|
<td><p class="text-success">Adhérent</p></td>
|
||||||
{% if user.is_adherent %}
|
{% elif not utilisateur.end_adhesion %}
|
||||||
<td><p class="text-success">Adhérent</p></td>
|
<td><p class="text-warning">On ne s'en souvient plus...</p></td>
|
||||||
{% elif not user.end_adhesion %}
|
{% else %}
|
||||||
<td><p class="text-danger">On ne s'en souvient plus...</p></td>
|
<td><p class="text-danger">Plus depuis {{ utilisateur.end_adhesion }}</p></td>
|
||||||
{% else %}
|
{% endif %}
|
||||||
<td><p class="text-danger">Plus depuis {{ user.end_adhesion }}</p></td>
|
<td>{{ utilisateur.last_login }}</td>
|
||||||
{% endif %}
|
<td>{{ utilisateur.num }}</td>
|
||||||
<td>{{ user.last_login }}</td>
|
{% if not utilisateur.last %}
|
||||||
<td>{{ user.name }}</td>
|
<td><p class="text-danger">Jamais</p></td>
|
||||||
</tr>
|
{% else %}
|
||||||
{% endfor %}
|
<td><p class="text-success">{{utilisateur.last}}</p></td>
|
||||||
|
{% endif %}
|
||||||
</table>
|
<td>
|
||||||
</div>
|
<a href="{% url 'users:del-group' utilisateur.id droit.id %}">
|
||||||
|
<button type="button" class="btn btn-danger" aria-label="Left Align">
|
||||||
|
<span class="fa fa-user-times" aria-hidden="true"></span>
|
||||||
<!--
|
</button>
|
||||||
<div class="table-responsive" ">
|
</a>
|
||||||
<table class="table table-striped" ">
|
</td>
|
||||||
|
</tr>
|
||||||
{% for user in droit.user_set.all %}
|
{% endfor %}
|
||||||
|
</table>
|
||||||
<tr>
|
</div>
|
||||||
<div class="table-responsive" ">
|
</div>
|
||||||
<table class="table table-striped" ">
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Pseudo</td>
|
|
||||||
<td>Adhésion</td>
|
|
||||||
<td>Derniere connection</td>
|
|
||||||
<td>Nombre d'actions</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>{{ user.name }}</td>
|
|
||||||
<td>{{ user.is_adherent }}</td>
|
|
||||||
<td>{{ user.last_login }}</td>
|
|
||||||
<td>{{ user.name }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
|
@ -43,10 +43,13 @@ from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
|
from django.db.models import Max
|
||||||
|
|
||||||
from reversion.models import Revision
|
from reversion.models import Revision
|
||||||
from reversion.models import Version, ContentType
|
from reversion.models import Version, ContentType
|
||||||
|
|
||||||
|
from time import time
|
||||||
|
|
||||||
from users.models import (
|
from users.models import (
|
||||||
User,
|
User,
|
||||||
ServiceUser,
|
ServiceUser,
|
||||||
|
@ -450,6 +453,20 @@ def stats_actions(request):
|
||||||
@login_required
|
@login_required
|
||||||
@can_view_app('users')
|
@can_view_app('users')
|
||||||
def stats_droits(request):
|
def stats_droits(request):
|
||||||
"""Affiche la liste des droits disponibles"""
|
"""Affiche la liste des droits et les users ayant chaque droit"""
|
||||||
droits=ListRight.objects.all().prefetch_related('user_set')
|
depart=time()
|
||||||
return render(request, 'logs/stats_droits.html', {'stats_list': droits})
|
stats_list={}
|
||||||
|
|
||||||
|
for droit in ListRight.objects.all().select_related('group_ptr'):#.prefetch_related('group_ptr__user_set__revision_set'):
|
||||||
|
stats_list[droit]=droit.user_set.all().annotate(num=Count('revision'),last=Max('revision__date_created'))
|
||||||
|
|
||||||
|
# count,last=0,0
|
||||||
|
# for droit in ListRight.objects.all():
|
||||||
|
# for use in droit.user_set.all():
|
||||||
|
# countRevision.objects.filter(user=use).count()
|
||||||
|
# print(Revision.objects.order_by('date_created').last().date_created)
|
||||||
|
# stats_list[droit]=use.annotate(num=count,las)
|
||||||
|
|
||||||
|
#raise ValueError('temps='+str(time()-depart))
|
||||||
|
|
||||||
|
return render(request, 'logs/stats_droits.html', {'stats_list': stats_list})
|
||||||
|
|
Loading…
Reference in a new issue