Commit b7b76ba0 authored by Dalahro's avatar Dalahro

Remplacement date inscription par date fin cotis dans liste

Petit tiret
parent 4f2236c9
...@@ -12,6 +12,7 @@ from machines.models import Machine, Interface ...@@ -12,6 +12,7 @@ from machines.models import Machine, Interface
from cotisations.models import Facture from cotisations.models import Facture
from search.models import SearchForm, SearchFormPlus from search.models import SearchForm, SearchFormPlus
from users.views import has_access from users.views import has_access
from cotisations.views import end_adhesion
def form(ctx, template, request): def form(ctx, template, request):
c = ctx c = ctx
...@@ -54,9 +55,13 @@ def search_result(search, type): ...@@ -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) users = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query)
connexion = [] connexion = []
for user in users: for user in users:
end=end_adhesion(user)
access=has_access(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))): 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) query = Q(user__pseudo__icontains = search) | Q(user__name__icontains = search) | Q(user__surname__icontains = search)
if i == '1': if i == '1':
machines = Interface.objects.filter(machine=Machine.objects.filter(query)) | Interface.objects.filter(Q(dns__icontains = search)) machines = Interface.objects.filter(machine=Machine.objects.filter(query)) | Interface.objects.filter(Q(dns__icontains = search))
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<th>Prénom</th> <th>Prénom</th>
<th>Nom</th> <th>Nom</th>
<th>Pseudo</th> <th>Pseudo</th>
<th>Inscrit le</th> <th>Fin de cotisation le</th>
<th>Connexion</th> <th>Connexion</th>
<th>Profil</th> <th>Profil</th>
</tr> </tr>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<td>{{ donnee.0.name }}</td> <td>{{ donnee.0.name }}</td>
<td>{{ donnee.0.surname }}</td> <td>{{ donnee.0.surname }}</td>
<td>{{ donnee.0.pseudo }}</td> <td>{{ donnee.0.pseudo }}</td>
<td>{{ donnee.0.registered }}</td> <td>{{ donnee.2 }}</td>
<td>{% if donnee.1 == True %} <td>{% if donnee.1 == True %}
<font color="green">Active</font> <font color="green">Active</font>
{% else %} {% else %}
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
{% endif %} {% endif %}
<th>Droits</th> <th>Droits</th>
{% if list_droits %} {% if list_droits %}
<td>{% for droit in list_droits %}{{ droit.right }} - {% endfor %}</td> <td>{% for droit in list_droits %}{{ droit.right }}{% if list_droits|length != forloop.counter %} - {% endif %} {% endfor %}</td>
{% else %} {% else %}
<td>Aucun</td> <td>Aucun</td>
{% endif %} {% endif %}
......
...@@ -221,7 +221,12 @@ def index(request): ...@@ -221,7 +221,12 @@ def index(request):
users_list = User.objects.order_by('pk') users_list = User.objects.order_by('pk')
connexion = [] connexion = []
for user in users_list: 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}) return render(request, 'users/index.html', {'users_list': connexion})
def index_ban(request): def index_ban(request):
......
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