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

Fix bug recherche, divers améliorations

This commit is contained in:
Dalahro 2016-11-24 18:12:11 +01:00
parent a0f59cc4a0
commit 581eeb1a0d
3 changed files with 8 additions and 6 deletions

View file

@ -47,15 +47,17 @@ def search_result(search, type, request):
connexion = [] connexion = []
recherche = {'users_list': None, 'machines_list' : None, 'facture_list' : None, 'ban_list' : None, 'white_list': None, 'port_list': None, 'switch_list': None} recherche = {'users_list': None, 'machines_list' : [], 'facture_list' : None, 'ban_list' : None, 'white_list': None, 'port_list': None, 'switch_list': None}
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)
for i in aff: for i in aff:
if i == '0': if i == '0':
recherche['users_list'] = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query1) recherche['users_list'] = User.objects.filter((Q(room__name__icontains = search) | Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query1).order_by('state', 'surname')
if i == '1': if i == '1':
recherche['machines_list'] = Machine.objects.filter(query | Q(interface__dns__icontains = search) | Q(interface__mac_address__icontains = search)) data = Interface.objects.filter(Q(machine__user__pseudo__icontains = search) | Q(machine__user__name__icontains = search) | Q(machine__user__surname__icontains = search) | Q(dns__icontains = search) | Q(mac_address__icontains = search) | Q(ipv4__ipv4__icontains = search))
for d in data:
recherche['machines_list'].append(d.machine)
if i == '2': if i == '2':
recherche['facture_list'] = Facture.objects.filter(query & date_query) recherche['facture_list'] = Facture.objects.filter(query & date_query)
if i == '3': if i == '3':

View file

@ -8,7 +8,7 @@
<th>Prénom</th> <th>Prénom</th>
<th>Nom</th> <th>Nom</th>
<th>Pseudo</th> <th>Pseudo</th>
<th>Uid</th> <th>Chambre</th>
<th>Fin de cotisation le</th> <th>Fin de cotisation le</th>
<th>Connexion</th> <th>Connexion</th>
<th>Profil</th> <th>Profil</th>
@ -19,7 +19,7 @@
<td>{{ user.name }}</td> <td>{{ user.name }}</td>
<td>{{ user.surname }}</td> <td>{{ user.surname }}</td>
<td>{{ user.pseudo }}</td> <td>{{ user.pseudo }}</td>
<td>{{ user.uid_number }}</td> <td>{{ user.room }}</td>
<td>{% if user.is_adherent %}{{ user.end_adhesion }}{% else %}Non adhérent{% endif %}</td> <td>{% if user.is_adherent %}{{ user.end_adhesion }}{% else %}Non adhérent{% endif %}</td>
<td>{% if user.has_access == True %} <td>{% if user.has_access == True %}
<font color="green">Active</font> <font color="green">Active</font>

View file

@ -426,7 +426,7 @@ def del_listright(request):
@permission_required('cableur') @permission_required('cableur')
def index(request): def index(request):
""" Affiche l'ensemble des users, need droit cableur """ """ Affiche l'ensemble des users, need droit cableur """
users_list = User.objects.order_by('pk') users_list = User.objects.order_by('state', 'name')
paginator = Paginator(users_list, PAGINATION_NUMBER) paginator = Paginator(users_list, PAGINATION_NUMBER)
page = request.GET.get('page') page = request.GET.get('page')
try: try: