From 01a63d361b9f6057aaf3f31e212dc909858ef814 Mon Sep 17 00:00:00 2001 From: Dalahro Date: Tue, 5 Jul 2016 20:01:37 +0200 Subject: [PATCH] Remplacement date inscription par date fin cotis dans liste Petit tiret --- search/views.py | 7 ++++++- users/templates/users/aff_users.html | 4 ++-- users/templates/users/profil.html | 2 +- users/views.py | 7 ++++++- 4 files changed, 15 insertions(+), 5 deletions(-) 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 @@ Prénom Nom Pseudo - Inscrit le + Fin de cotisation le Connexion Profil @@ -14,7 +14,7 @@ {{ donnee.0.name }} {{ donnee.0.surname }} {{ donnee.0.pseudo }} - {{ donnee.0.registered }} + {{ donnee.2 }} {% if donnee.1 == True %} Active {% else %} diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 1e8fe834..ea5793fd 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -74,7 +74,7 @@ {% endif %} Droits {% if list_droits %} - {% for droit in list_droits %}{{ droit.right }} - {% endfor %} + {% for droit in list_droits %}{{ droit.right }}{% if list_droits|length != forloop.counter %} - {% endif %} {% endfor %} {% else %} Aucun {% endif %} diff --git a/users/views.py b/users/views.py index a4ae76c4..a2cc32a9 100644 --- a/users/views.py +++ b/users/views.py @@ -221,7 +221,12 @@ def index(request): users_list = User.objects.order_by('pk') connexion = [] for user in users_list: - connexion.append([user, has_access(user)]) + end = end_adhesion(user) + access = has_access(user) + if(end!=None): + connexion.append([user, access, end]) + else: + connexion.append([user, access, "Non adhérent"]) return render(request, 'users/index.html', {'users_list': connexion}) def index_ban(request):