mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +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.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, Max
|
||||||
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
|
||||||
|
@ -457,7 +456,7 @@ def stats_droits(request):
|
||||||
depart=time()
|
depart=time()
|
||||||
stats_list={}
|
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'))
|
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})
|
return render(request, 'logs/stats_droits.html', {'stats_list': stats_list})
|
||||||
|
|
|
@ -260,7 +260,7 @@ def search_single_word(word, filters, user,
|
||||||
) | Q(
|
) | Q(
|
||||||
machine_interface__domain__name__icontains=word
|
machine_interface__domain__name__icontains=word
|
||||||
) | Q(
|
) | Q(
|
||||||
related__switch__switch_interface__domain__name__icontains=word
|
related__switch__domain__name__icontains=word
|
||||||
) | Q(
|
) | Q(
|
||||||
radius__icontains=word
|
radius__icontains=word
|
||||||
) | Q(
|
) | Q(
|
||||||
|
@ -277,9 +277,9 @@ def search_single_word(word, filters, user,
|
||||||
# Switches
|
# Switches
|
||||||
if '7' in aff and Switch.can_view_all(user):
|
if '7' in aff and Switch.can_view_all(user):
|
||||||
filter_switches = Q(
|
filter_switches = Q(
|
||||||
switch_interface__domain__name__icontains=word
|
domain__name__icontains=word
|
||||||
) | Q(
|
) | Q(
|
||||||
switch_interface__ipv4__ipv4__icontains=word
|
ipv4__ipv4__icontains=word
|
||||||
) | Q(
|
) | Q(
|
||||||
location__icontains=word
|
location__icontains=word
|
||||||
) | Q(
|
) | Q(
|
||||||
|
|
|
@ -501,8 +501,7 @@ def del_school(request, instances):
|
||||||
@login_required
|
@login_required
|
||||||
@can_create(ListShell)
|
@can_create(ListShell)
|
||||||
def add_shell(request):
|
def add_shell(request):
|
||||||
""" Ajouter un établissement d'enseignement à la base de donnée,
|
""" Ajouter un shell à la base de donnée"""
|
||||||
need cableur"""
|
|
||||||
shell = ShellForm(request.POST or None)
|
shell = ShellForm(request.POST or None)
|
||||||
if shell.is_valid():
|
if shell.is_valid():
|
||||||
with transaction.atomic(), reversion.create_revision():
|
with transaction.atomic(), reversion.create_revision():
|
||||||
|
@ -517,8 +516,7 @@ def add_shell(request):
|
||||||
@login_required
|
@login_required
|
||||||
@can_edit(ListShell)
|
@can_edit(ListShell)
|
||||||
def edit_shell(request, shell_instance, shellid):
|
def edit_shell(request, shell_instance, shellid):
|
||||||
""" Editer un établissement d'enseignement à partir du shellid dans
|
""" Editer un shell à partir du shellid"""
|
||||||
la base de donnée, need cableur"""
|
|
||||||
shell = ShellForm(request.POST or None, instance=shell_instance)
|
shell = ShellForm(request.POST or None, instance=shell_instance)
|
||||||
if shell.is_valid():
|
if shell.is_valid():
|
||||||
with transaction.atomic(), reversion.create_revision():
|
with transaction.atomic(), reversion.create_revision():
|
||||||
|
|
Loading…
Reference in a new issue