mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 23:43:47 +00:00
Plus de BÔTÉ dans l'affichage des superusers
This commit is contained in:
parent
8a19977757
commit
9d79ffb5ca
3 changed files with 13 additions and 4 deletions
|
@ -66,7 +66,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td><p class="text-success">{{utilisateur.last}}</p></td>
|
<td><p class="text-success">{{utilisateur.last}}</p></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>
|
<td>
|
||||||
|
{% if droit != 'Superuser' %}
|
||||||
<a href="{% url 'users:del-group' utilisateur.id droit.id %}">
|
<a href="{% url 'users:del-group' utilisateur.id droit.id %}">
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url 'users:del-superuser' utilisateur.id %}">
|
||||||
|
{% endif %}
|
||||||
<button type="button" class="btn btn-danger" aria-label="Left Align">
|
<button type="button" class="btn btn-danger" aria-label="Left Align">
|
||||||
<span class="fa fa-user-times" aria-hidden="true"></span>
|
<span class="fa fa-user-times" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -41,7 +41,7 @@ from django.urls import reverse
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
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, Max
|
from django.db.models import Count, Max, F
|
||||||
|
|
||||||
from reversion.models import Revision
|
from reversion.models import Revision
|
||||||
from reversion.models import Version, ContentType
|
from reversion.models import Version, ContentType
|
||||||
|
@ -469,7 +469,12 @@ def stats_droits(request):
|
||||||
for droit in ListRight.objects.all().select_related('group_ptr'):
|
for droit in ListRight.objects.all().select_related('group_ptr'):
|
||||||
stats_list[droit] = droit.user_set.all().annotate(
|
stats_list[droit] = droit.user_set.all().annotate(
|
||||||
num=Count('revision'),
|
num=Count('revision'),
|
||||||
last=Max('revision__date_created')
|
last=Max('revision__date_created'),
|
||||||
|
)
|
||||||
|
|
||||||
|
stats_list['Superuser'] = User.objects.filter(is_superuser=True).annotate(
|
||||||
|
num=Count('revision'),
|
||||||
|
last=Max('revision__date_created'),
|
||||||
)
|
)
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
|
|
|
@ -457,7 +457,7 @@ class GroupForm(FormRevMixin, ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ['groups', 'is_superuser']
|
fields = ['is_superuser', 'groups']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
|
|
Loading…
Reference in a new issue