Commit 95dc6b7f authored by Mael Kervella's avatar Mael Kervella

Merge branch 'search' into 'master'

Search improved

Closes #32

See merge request rezo/re2o!29
parents 7b4432ef 57021ad5
......@@ -45,21 +45,32 @@ CHOICES_AFF = (
)
def initial_choices(c):
def initial_choices(choice_set):
"""Return the choices that should be activated by default for a
given set of choices"""
return [i[0] for i in c]
return [i[0] for i in choice_set]
class SearchForm(Form):
"""The form for a simple search"""
q = forms.CharField(label='Search', max_length=100)
q = forms.CharField(
label='Recherche',
help_text=(
'Utilisez « » et «,» pour spécifier différents mots, «"query"» '
'pour une recherche exacte et «\\» pour échapper un caractère.'
),
max_length=100
)
class SearchFormPlus(Form):
"""The form for an advanced search (with filters)"""
q = forms.CharField(
label='Search',
label='Recherche',
help_text=(
'Utilisez « » et «,» pour spécifier différents mots, «"query"» '
'pour une recherche exacte et «\\» pour échapper un caractère.'
),
max_length=100,
required=False
)
......
......@@ -28,39 +28,39 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}Résultats de la recherche{% endblock %}
{% block content %}
{% if users_list %}
{% if users %}
<h2>Résultats dans les utilisateurs</h2>
{% include "users/aff_users.html" with users_list=users_list %}
{% include "users/aff_users.html" with users_list=users %}
{% endif%}
{% if machines_list %}
{% if machines %}
<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 %}
{% endif %}
{% if factures_list %}
{% if factures %}
<h2>Résultats dans les factures : </h2>
{% include "cotisations/aff_cotisations.html" with facture_list=factures_list %}
{% include "cotisations/aff_cotisations.html" with facture_list=factures %}
{% endif %}
{% if whitelists_list %}
{% if whitelists %}
<h2>Résultats dans les accès à titre gracieux : </h2>
{% include "users/aff_whitelists.html" with white_list=whitelists_list %}
{% include "users/aff_whitelists.html" with white_list=whitelists %}
{% endif %}
{% if bans_list %}
{% if bans %}
<h2>Résultats dans les banissements : </h2>
{% include "users/aff_bans.html" with ban_list=bans_list %}
{% include "users/aff_bans.html" with ban_list=bans %}
{% endif %}
{% if rooms_list %}
{% if rooms %}
<h2>Résultats dans les chambres : </h2>
{% include "topologie/aff_chambres.html" with room_list=rooms_list %}
{% include "topologie/aff_chambres.html" with room_list=rooms %}
{% endif %}
{% if switch_ports_list %}
{% if ports %}
<h2>Résultats dans les ports : </h2>
{% include "topologie/aff_port.html" with port_list=switch_ports_list %}
{% include "topologie/aff_port.html" with port_list=ports %}
{% endif %}
{% if switches_list %}
{% if switches %}
<h2>Résultats dans les switchs : </h2>
{% include "topologie/aff_switch.html" with switch_list=switches_list %}
{% include "topologie/aff_switch.html" with switch_list=switches %}
{% endif %}
{% if not users_list and not machines_list and not factures_list and not whitelists_list and not bans_list and not rooms_list and not switch_ports_list and not switches_list %}
{% if not users and not machines and not factures and not whitelists and not bans and not rooms and not ports and not switches %}
<h3>Aucun résultat</h3>
{% else %}
<h6>(Seulement les {{ max_result }} premiers résultats sont affichés dans chaque catégorie)</h6>
......
This diff is collapsed.
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