diff --git a/search/views.py b/search/views.py index daf12f60..28830313 100644 --- a/search/views.py +++ b/search/views.py @@ -12,6 +12,7 @@ from machines.models import Machine, Interface from cotisations.models import Facture from search.models import SearchForm, SearchFormPlus from users.views import has_access +from cotisations.views import end_adhesion def form(ctx, template, request): c = ctx @@ -54,9 +55,13 @@ def search_result(search, type): users = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query) connexion = [] for user in users: + end=end_adhesion(user) access=has_access(user) if(len(co)==0 or (len(co)==1 and bool(co[0])==access) or (len(co)==2 and (bool(co[0])==access or bool(co[1])==access))): - connexion.append([user, access]) + if(end!=None): + connexion.append([user, access, end]) + else: + connexion.append([user, access, "Non adhérent"]) query = Q(user__pseudo__icontains = search) | Q(user__name__icontains = search) | Q(user__surname__icontains = search) if i == '1': machines = Interface.objects.filter(machine=Machine.objects.filter(query)) | Interface.objects.filter(Q(dns__icontains = search)) diff --git a/users/templates/users/aff_users.html b/users/templates/users/aff_users.html index 8ad206cc..07dd5bef 100644 --- a/users/templates/users/aff_users.html +++ b/users/templates/users/aff_users.html @@ -4,7 +4,7 @@