mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Fix divers
This commit is contained in:
parent
a0afb3e5b4
commit
50d04b0ae2
3 changed files with 7 additions and 10 deletions
|
@ -42,8 +42,7 @@ from django.shortcuts import render, redirect
|
|||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Count
|
||||
from django.db.models import Max
|
||||
from django.db.models import Count, Max
|
||||
|
||||
from reversion.models import Revision
|
||||
from reversion.models import Version, ContentType
|
||||
|
@ -457,7 +456,7 @@ def stats_droits(request):
|
|||
depart=time()
|
||||
stats_list={}
|
||||
|
||||
for droit in ListRight.objects.all().select_related('group_ptr'):#.prefetch_related('group_ptr__user_set__revision_set'):
|
||||
for droit in ListRight.objects.all().select_related('group_ptr'):
|
||||
stats_list[droit]=droit.user_set.all().annotate(num=Count('revision'),last=Max('revision__date_created'))
|
||||
|
||||
return render(request, 'logs/stats_droits.html', {'stats_list': stats_list})
|
||||
|
|
|
@ -260,7 +260,7 @@ def search_single_word(word, filters, user,
|
|||
) | Q(
|
||||
machine_interface__domain__name__icontains=word
|
||||
) | Q(
|
||||
related__switch__switch_interface__domain__name__icontains=word
|
||||
related__switch__domain__name__icontains=word
|
||||
) | Q(
|
||||
radius__icontains=word
|
||||
) | Q(
|
||||
|
@ -277,9 +277,9 @@ def search_single_word(word, filters, user,
|
|||
# Switches
|
||||
if '7' in aff and Switch.can_view_all(user):
|
||||
filter_switches = Q(
|
||||
switch_interface__domain__name__icontains=word
|
||||
domain__name__icontains=word
|
||||
) | Q(
|
||||
switch_interface__ipv4__ipv4__icontains=word
|
||||
ipv4__ipv4__icontains=word
|
||||
) | Q(
|
||||
location__icontains=word
|
||||
) | Q(
|
||||
|
|
|
@ -501,8 +501,7 @@ def del_school(request, instances):
|
|||
@login_required
|
||||
@can_create(ListShell)
|
||||
def add_shell(request):
|
||||
""" Ajouter un établissement d'enseignement à la base de donnée,
|
||||
need cableur"""
|
||||
""" Ajouter un shell à la base de donnée"""
|
||||
shell = ShellForm(request.POST or None)
|
||||
if shell.is_valid():
|
||||
with transaction.atomic(), reversion.create_revision():
|
||||
|
@ -517,8 +516,7 @@ def add_shell(request):
|
|||
@login_required
|
||||
@can_edit(ListShell)
|
||||
def edit_shell(request, shell_instance, shellid):
|
||||
""" Editer un établissement d'enseignement à partir du shellid dans
|
||||
la base de donnée, need cableur"""
|
||||
""" Editer un shell à partir du shellid"""
|
||||
shell = ShellForm(request.POST or None, instance=shell_instance)
|
||||
if shell.is_valid():
|
||||
with transaction.atomic(), reversion.create_revision():
|
||||
|
|
Loading…
Reference in a new issue