8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 15:12:25 +00:00

Seulement 15 résultats affichés dans la recherche

This commit is contained in:
Dalahro 2016-10-08 00:38:02 +02:00
parent 4bb831f18d
commit 7d557a137e
2 changed files with 9 additions and 8 deletions

View file

@ -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%} {% 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> <h3>Aucun résultat</h3>
{% endif %} {% endif %}
<h6>(Seulement les 15 premiers résultats sont affichés dans chaque catégorie)</h6>
<br /> <br />
<br /> <br />
<br /> <br />

View file

@ -54,21 +54,21 @@ def search_result(search, type, request):
for i in aff: for i in aff:
if i == '0': 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) query = Q(user__pseudo__icontains = search) | Q(user__name__icontains = search) | Q(user__surname__icontains = search)
if i == '1': 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': if i == '2':
factures = Facture.objects.filter(query & date_query) factures = Facture.objects.filter(query & date_query)[:15]
if i == '3': if i == '3':
bans = Ban.objects.filter(query) bans = Ban.objects.filter(query)[:15]
if i == '4': if i == '4':
whitelists = Whitelist.objects.filter(query) whitelists = Whitelist.objects.filter(query)[:15]
if i == '5': if i == '5':
portlist = Port.objects.filter(details__icontains = search) portlist = Port.objects.filter(details__icontains = search)[:15]
if i == '6': if i == '6':
switchlist = Switch.objects.filter(details__icontains = search) switchlist = Switch.objects.filter(details__icontains = search)[:15]
return {'users_list': users, 'interfaces_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist} return {'users_list': users, 'machines_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
@login_required @login_required
def search(request): def search(request):