mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-28 01:43:46 +00:00
Seulement 15 résultats affichés dans la recherche
This commit is contained in:
parent
4bb831f18d
commit
7d557a137e
2 changed files with 9 additions and 8 deletions
|
@ -35,6 +35,7 @@
|
|||
{% if not ban_list and not interfaces_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>
|
||||
{% endif %}
|
||||
<h6>(Seulement les 15 premiers résultats sont affichés dans chaque catégorie)</h6>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
|
|
@ -54,21 +54,21 @@ def search_result(search, type, request):
|
|||
|
||||
for i in aff:
|
||||
if i == '0':
|
||||
users = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query)
|
||||
users = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query)[:15]
|
||||
query = Q(user__pseudo__icontains = search) | Q(user__name__icontains = search) | Q(user__surname__icontains = search)
|
||||
if i == '1':
|
||||
machines = Interface.objects.filter(machine=Machine.objects.filter(query)) | Interface.objects.filter(Q(dns__icontains = search))
|
||||
machines = Machine.objects.filter(query)[:15]
|
||||
if i == '2':
|
||||
factures = Facture.objects.filter(query & date_query)
|
||||
factures = Facture.objects.filter(query & date_query)[:15]
|
||||
if i == '3':
|
||||
bans = Ban.objects.filter(query)
|
||||
bans = Ban.objects.filter(query)[:15]
|
||||
if i == '4':
|
||||
whitelists = Whitelist.objects.filter(query)
|
||||
whitelists = Whitelist.objects.filter(query)[:15]
|
||||
if i == '5':
|
||||
portlist = Port.objects.filter(details__icontains = search)
|
||||
portlist = Port.objects.filter(details__icontains = search)[:15]
|
||||
if i == '6':
|
||||
switchlist = Switch.objects.filter(details__icontains = search)
|
||||
return {'users_list': users, 'interfaces_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
|
||||
switchlist = Switch.objects.filter(details__icontains = search)[:15]
|
||||
return {'users_list': users, 'machines_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
|
||||
|
||||
@login_required
|
||||
def search(request):
|
||||
|
|
Loading…
Reference in a new issue