Commit 45b691fc authored by Maël Kervella's avatar Maël Kervella

Renommage des listes de résultats + fix "Aucun résultat" & droit cableur

parent 5c3cf78b
......@@ -36,30 +36,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>Résultats dans les machines : </h2>
{% include "machines/aff_machines.html" with machines_list=machines_list %}
{% endif %}
{% if facture_list %}
{% if factures_list %}
<h2>Résultats dans les factures : </h2>
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
{% include "cotisations/aff_cotisations.html" with facture_list=factures_list %}
{% endif %}
{% if white_list %}
{% if whitelists_list %}
<h2>Résultats dans les accès à titre gracieux : </h2>
{% include "users/aff_whitelists.html" with white_list=white_list %}
{% include "users/aff_whitelists.html" with white_list=whitelists_list %}
{% endif %}
{% if ban_list %}
{% if bans_list %}
<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=bans_list %}
{% endif %}
{% if switch_list %}
<h2>Résultats dans les switchs : </h2>
{% include "topologie/aff_switch.html" with switch_list=switch_list %}
{% endif %}
{% if port_list %}
{% if switch_ports_list %}
<h2>Résultats dans les ports : </h2>
{% include "topologie/aff_port.html" with port_list=port_list %}
{% include "topologie/aff_port.html" with port_list=switch_ports_list %}
{% endif %}
{% if switches_list %}
<h2>Résultats dans les switchs : </h2>
{% include "topologie/aff_switch.html" with switch_list=switches_list %}
{% endif %}
{% 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 users_list and not machines_list and not factures_list and not whitelists_list and not bans_list and not switch_ports_list and not switches_list%}
<h3>Aucun résultat</h3>
{% else %}
<h6>(Seulement les {{ max_result }} premiers résultats sont affichés dans chaque catégorie)</h6>
{% endif %}
<h6>(Seulement les {{ max_result }} premiers résultats sont affichés dans chaque catégorie)</h6>
<br />
<br />
<br />
......
......@@ -65,11 +65,11 @@ def get_results(query, request, filters={}):
results = {
'users_list': User.objects.none(),
'machines_list' : Machine.objects.none(),
'facture_list' : Facture.objects.none(),
'ban_list' : Ban.objects.none(),
'white_list': Whitelist.objects.none(),
'port_list': Port.objects.none(),
'switch_list': Switch.objects.none()
'factures_list' : Facture.objects.none(),
'bans_list' : Ban.objects.none(),
'whitelists_list': Whitelist.objects.none(),
'switch_ports_list': Port.objects.none(),
'switches_list': Switch.objects.none()
}
users_filter = Q(
......@@ -139,9 +139,9 @@ def get_results(query, request, filters={}):
filter_facture_list &= Q(date__gte=start)
if end != None:
filter_facture_list &= Q(date__lte=end)
results['facture_list'] = Facture.objects.filter(filter_facture_list)
results['facture_list'] = SortTable.sort(
results['facture_list'],
results['factures_list'] = Facture.objects.filter(filter_facture_list)
results['factures_list'] = SortTable.sort(
results['factures_list'],
request.GET.get('col'),
request.GET.get('order'),
SortTable.COTISATIONS_INDEX
......@@ -166,9 +166,9 @@ def get_results(query, request, filters={}):
) | (
Q(date_start__gte=end) & Q(date_end__lte=end)
)
results['ban_list'] = Ban.objects.filter(users_filter & date_filter)
results['ban_list'] = SortTable.sort(
results['ban_list'],
results['bans_list'] = Ban.objects.filter(users_filter & date_filter)
results['bans_list'] = SortTable.sort(
results['bans_list'],
request.GET.get('col'),
request.GET.get('order'),
SortTable.USERS_INDEX_BAN
......@@ -193,9 +193,9 @@ def get_results(query, request, filters={}):
) | (
Q(date_start__gte=end) & Q(date_end__lte=end)
)
results['white_list'] = Whitelist.objects.filter(users_filter & date_filter)
results['white_list'] = SortTable.sort(
results['white_list'],
results['whitelists_list'] = Whitelist.objects.filter(users_filter & date_filter)
results['whitelists_list'] = SortTable.sort(
results['whitelists_list'],
request.GET.get('col'),
request.GET.get('order'),
SortTable.USERS_INDEX_WHITE
......@@ -203,19 +203,19 @@ def get_results(query, request, filters={}):
# Switch ports
if '5' in aff and request.user.has_perms(('cableur',)):
results['port_list'] = Port.objects.filter(details__icontains=query)
results['port_list'] = SortTable.sort(
results['port_list'],
results['switch_ports_list'] = Port.objects.filter(details__icontains=query)
results['switch_ports_list'] = SortTable.sort(
results['switch_ports_list'],
request.GET.get('col'),
request.GET.get('order'),
SortTable.TOPOLOGIE_INDEX_PORT
)
# Switches
if '6' in aff and request.user.has_perms(('cableur')):
results['switch_list'] = Switch.objects.filter(details__icontains=query)
results['switch_list'] = SortTable.sort(
results['switch_list'],
if '6' in aff and request.user.has_perms(('cableur',)):
results['switches_list'] = Switch.objects.filter(details__icontains=query)
results['switches_list'] = SortTable.sort(
results['switches_list'],
request.GET.get('col'),
request.GET.get('order'),
SortTable.TOPOLOGIE_INDEX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment