From 50d04b0ae2623adc7c1af7df5e2ef893de877aa7 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 25 Mar 2018 23:01:06 +0200 Subject: [PATCH] Fix divers --- logs/views.py | 5 ++--- search/views.py | 6 +++--- users/views.py | 6 ++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/logs/views.py b/logs/views.py index b3af50e9..6ab48706 100644 --- a/logs/views.py +++ b/logs/views.py @@ -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}) diff --git a/search/views.py b/search/views.py index 601f4eeb..21279bfa 100644 --- a/search/views.py +++ b/search/views.py @@ -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( diff --git a/users/views.py b/users/views.py index a6a28ed0..a0d46fe8 100644 --- a/users/views.py +++ b/users/views.py @@ -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():