mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Renommage des listes de résultats + fix "Aucun résultat" & droit cableur
This commit is contained in:
parent
7290afc7f0
commit
c093923e15
2 changed files with 36 additions and 35 deletions
|
@ -36,30 +36,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<h2>Résultats dans les machines : </h2>
|
<h2>Résultats dans les machines : </h2>
|
||||||
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if facture_list %}
|
{% if factures_list %}
|
||||||
<h2>Résultats dans les factures : </h2>
|
<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 %}
|
{% endif %}
|
||||||
{% if white_list %}
|
{% if whitelists_list %}
|
||||||
<h2>Résultats dans les accès à titre gracieux : </h2>
|
<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 %}
|
{% endif %}
|
||||||
{% if ban_list %}
|
{% if bans_list %}
|
||||||
<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=bans_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if switch_list %}
|
{% if switch_ports_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>
|
<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 %}
|
{% 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 switches_list %}
|
||||||
|
<h2>Résultats dans les switchs : </h2>
|
||||||
|
{% include "topologie/aff_switch.html" with switch_list=switches_list %}
|
||||||
|
{% endif %}
|
||||||
|
{% 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>
|
<h3>Aucun résultat</h3>
|
||||||
{% endif %}
|
{% else %}
|
||||||
<h6>(Seulement les {{ max_result }} premiers résultats sont affichés dans chaque catégorie)</h6>
|
<h6>(Seulement les {{ max_result }} premiers résultats sont affichés dans chaque catégorie)</h6>
|
||||||
|
{% endif %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -65,11 +65,11 @@ def get_results(query, request, filters={}):
|
||||||
results = {
|
results = {
|
||||||
'users_list': User.objects.none(),
|
'users_list': User.objects.none(),
|
||||||
'machines_list' : Machine.objects.none(),
|
'machines_list' : Machine.objects.none(),
|
||||||
'facture_list' : Facture.objects.none(),
|
'factures_list' : Facture.objects.none(),
|
||||||
'ban_list' : Ban.objects.none(),
|
'bans_list' : Ban.objects.none(),
|
||||||
'white_list': Whitelist.objects.none(),
|
'whitelists_list': Whitelist.objects.none(),
|
||||||
'port_list': Port.objects.none(),
|
'switch_ports_list': Port.objects.none(),
|
||||||
'switch_list': Switch.objects.none()
|
'switches_list': Switch.objects.none()
|
||||||
}
|
}
|
||||||
|
|
||||||
users_filter = Q(
|
users_filter = Q(
|
||||||
|
@ -139,9 +139,9 @@ def get_results(query, request, filters={}):
|
||||||
filter_facture_list &= Q(date__gte=start)
|
filter_facture_list &= Q(date__gte=start)
|
||||||
if end != None:
|
if end != None:
|
||||||
filter_facture_list &= Q(date__lte=end)
|
filter_facture_list &= Q(date__lte=end)
|
||||||
results['facture_list'] = Facture.objects.filter(filter_facture_list)
|
results['factures_list'] = Facture.objects.filter(filter_facture_list)
|
||||||
results['facture_list'] = SortTable.sort(
|
results['factures_list'] = SortTable.sort(
|
||||||
results['facture_list'],
|
results['factures_list'],
|
||||||
request.GET.get('col'),
|
request.GET.get('col'),
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.COTISATIONS_INDEX
|
SortTable.COTISATIONS_INDEX
|
||||||
|
@ -166,9 +166,9 @@ def get_results(query, request, filters={}):
|
||||||
) | (
|
) | (
|
||||||
Q(date_start__gte=end) & Q(date_end__lte=end)
|
Q(date_start__gte=end) & Q(date_end__lte=end)
|
||||||
)
|
)
|
||||||
results['ban_list'] = Ban.objects.filter(users_filter & date_filter)
|
results['bans_list'] = Ban.objects.filter(users_filter & date_filter)
|
||||||
results['ban_list'] = SortTable.sort(
|
results['bans_list'] = SortTable.sort(
|
||||||
results['ban_list'],
|
results['bans_list'],
|
||||||
request.GET.get('col'),
|
request.GET.get('col'),
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.USERS_INDEX_BAN
|
SortTable.USERS_INDEX_BAN
|
||||||
|
@ -193,9 +193,9 @@ def get_results(query, request, filters={}):
|
||||||
) | (
|
) | (
|
||||||
Q(date_start__gte=end) & Q(date_end__lte=end)
|
Q(date_start__gte=end) & Q(date_end__lte=end)
|
||||||
)
|
)
|
||||||
results['white_list'] = Whitelist.objects.filter(users_filter & date_filter)
|
results['whitelists_list'] = Whitelist.objects.filter(users_filter & date_filter)
|
||||||
results['white_list'] = SortTable.sort(
|
results['whitelists_list'] = SortTable.sort(
|
||||||
results['white_list'],
|
results['whitelists_list'],
|
||||||
request.GET.get('col'),
|
request.GET.get('col'),
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.USERS_INDEX_WHITE
|
SortTable.USERS_INDEX_WHITE
|
||||||
|
@ -203,19 +203,19 @@ def get_results(query, request, filters={}):
|
||||||
|
|
||||||
# Switch ports
|
# Switch ports
|
||||||
if '5' in aff and request.user.has_perms(('cableur',)):
|
if '5' in aff and request.user.has_perms(('cableur',)):
|
||||||
results['port_list'] = Port.objects.filter(details__icontains=query)
|
results['switch_ports_list'] = Port.objects.filter(details__icontains=query)
|
||||||
results['port_list'] = SortTable.sort(
|
results['switch_ports_list'] = SortTable.sort(
|
||||||
results['port_list'],
|
results['switch_ports_list'],
|
||||||
request.GET.get('col'),
|
request.GET.get('col'),
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.TOPOLOGIE_INDEX_PORT
|
SortTable.TOPOLOGIE_INDEX_PORT
|
||||||
)
|
)
|
||||||
|
|
||||||
# Switches
|
# Switches
|
||||||
if '6' in aff and request.user.has_perms(('cableur')):
|
if '6' in aff and request.user.has_perms(('cableur',)):
|
||||||
results['switch_list'] = Switch.objects.filter(details__icontains=query)
|
results['switches_list'] = Switch.objects.filter(details__icontains=query)
|
||||||
results['switch_list'] = SortTable.sort(
|
results['switches_list'] = SortTable.sort(
|
||||||
results['switch_list'],
|
results['switches_list'],
|
||||||
request.GET.get('col'),
|
request.GET.get('col'),
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.TOPOLOGIE_INDEX
|
SortTable.TOPOLOGIE_INDEX
|
||||||
|
|
Loading…
Reference in a new issue