mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-26 08:53:46 +00:00
Recherche inclus switchs et ports
This commit is contained in:
parent
09d5e16975
commit
7603499a58
3 changed files with 21 additions and 4 deletions
|
@ -20,6 +20,8 @@ CHOICES3 = (
|
||||||
('2', 'Factures'),
|
('2', 'Factures'),
|
||||||
('3', 'Bannissements'),
|
('3', 'Bannissements'),
|
||||||
('4', 'Accès à titre gracieux'),
|
('4', 'Accès à titre gracieux'),
|
||||||
|
('6', 'Switchs'),
|
||||||
|
('5', 'Ports'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,15 @@
|
||||||
<h2>Résultats dans les banissements : </h2>
|
<h2>Résultats dans les banissements : </h2>
|
||||||
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not ban_list and not machine_list and not users_list and not facture_list and not white_list%}
|
{% if switch_list %}
|
||||||
|
<h2>Résultats dans les switchs : </h2>
|
||||||
|
{% include "topologie/aff_switch.html" with switch_list=switch_list %}
|
||||||
|
{% endif %}
|
||||||
|
{% if port_list %}
|
||||||
|
<h2>Résultats dans les ports : </h2>
|
||||||
|
{% include "topologie/aff_port.html" with port_list=port_list %}
|
||||||
|
{% endif %}
|
||||||
|
{% if not ban_list and not machine_list and not users_list and not facture_list and not white_list and not port_list and not switch_list%}
|
||||||
<h3>Aucun résultat</h3>
|
<h3>Aucun résultat</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.template import Context, RequestContext, loader
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from users.models import User, Ban, Whitelist
|
from users.models import User, Ban, Whitelist
|
||||||
from machines.models import Machine, Interface
|
from machines.models import Machine, Interface
|
||||||
|
from topologie.models import Port, Switch
|
||||||
from cotisations.models import Facture
|
from cotisations.models import Facture
|
||||||
from search.models import SearchForm, SearchFormPlus
|
from search.models import SearchForm, SearchFormPlus
|
||||||
from users.views import has_access
|
from users.views import has_access
|
||||||
|
@ -24,7 +25,7 @@ def search_result(search, type):
|
||||||
date_fin = None
|
date_fin = None
|
||||||
states=[]
|
states=[]
|
||||||
co=[]
|
co=[]
|
||||||
aff=['0','1','2','3','4']
|
aff=[]
|
||||||
if(type):
|
if(type):
|
||||||
aff = search.cleaned_data['affichage']
|
aff = search.cleaned_data['affichage']
|
||||||
co = search.cleaned_data['connexion']
|
co = search.cleaned_data['connexion']
|
||||||
|
@ -33,7 +34,7 @@ def search_result(search, type):
|
||||||
date_fin = search.cleaned_data['date_fin']
|
date_fin = search.cleaned_data['date_fin']
|
||||||
date_query = Q()
|
date_query = Q()
|
||||||
if aff==[]:
|
if aff==[]:
|
||||||
aff = ['0','1','2','3','4']
|
aff = ['0','1','2','3','4','5','6']
|
||||||
if date_deb != None:
|
if date_deb != None:
|
||||||
date_query = date_query & Q(date__gte=date_deb)
|
date_query = date_query & Q(date__gte=date_deb)
|
||||||
if date_fin != None:
|
if date_fin != None:
|
||||||
|
@ -48,6 +49,8 @@ def search_result(search, type):
|
||||||
factures = None
|
factures = None
|
||||||
bans = None
|
bans = None
|
||||||
whitelists = None
|
whitelists = None
|
||||||
|
switchlist = None
|
||||||
|
portlist = None
|
||||||
connexion = []
|
connexion = []
|
||||||
|
|
||||||
for i in aff:
|
for i in aff:
|
||||||
|
@ -71,7 +74,11 @@ def search_result(search, type):
|
||||||
bans = Ban.objects.filter(query)
|
bans = Ban.objects.filter(query)
|
||||||
if i == '4':
|
if i == '4':
|
||||||
whitelists = Whitelist.objects.filter(query)
|
whitelists = Whitelist.objects.filter(query)
|
||||||
return {'users_list': connexion, 'machine_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists}
|
if i == '5':
|
||||||
|
portlist = Port.objects.filter(details__icontains = search)
|
||||||
|
if i == '6':
|
||||||
|
switchlist = Switch.objects.filter(details__icontains = search)
|
||||||
|
return {'users_list': connexion, 'machine_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
|
||||||
|
|
||||||
def search(request):
|
def search(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
Loading…
Reference in a new issue