diff --git a/cotisations/__pycache__/views.cpython-34.pyc b/cotisations/__pycache__/views.cpython-34.pyc index 4fbbb82e..03ffb108 100644 Binary files a/cotisations/__pycache__/views.cpython-34.pyc and b/cotisations/__pycache__/views.cpython-34.pyc differ diff --git a/search/__pycache__/views.cpython-34.pyc b/search/__pycache__/views.cpython-34.pyc index 9d6cc725..da15f326 100644 Binary files a/search/__pycache__/views.cpython-34.pyc and b/search/__pycache__/views.cpython-34.pyc differ diff --git a/search/views.py b/search/views.py index d27c4614..4e2211dc 100644 --- a/search/views.py +++ b/search/views.py @@ -11,6 +11,7 @@ from users.models import User, Ban from machines.models import Machine from cotisations.models import Facture from search.models import SearchForm +from users.views import has_access def form(ctx, template, request): c = ctx @@ -23,11 +24,14 @@ def search(request): if search.is_valid(): search = search.cleaned_data['search_field'] users = User.objects.filter(Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) + connexion = [] + for user in users: + connexion.append([user, has_access(user)]) machines = None query = Q(user__pseudo__icontains = search) | Q(user__name__icontains = search) | Q(user__surname__icontains = search) factures = Facture.objects.filter(query) bans = Ban.objects.filter(query) - return form({'users_list': users, 'machine_list' : machines, 'facture_list' : factures, 'ban_list' : bans}, 'search/index.html',request) + return form({'users_list': connexion, 'machine_list' : machines, 'facture_list' : factures, 'ban_list' : bans}, 'search/index.html',request) return form({'searchform' : search}, 'search/search.html', request) else: search = SearchForm(request.POST or None) diff --git a/users/__pycache__/views.cpython-34.pyc b/users/__pycache__/views.cpython-34.pyc index ddf075bd..d2630750 100644 Binary files a/users/__pycache__/views.cpython-34.pyc and b/users/__pycache__/views.cpython-34.pyc differ diff --git a/users/templates/users/aff_users.html b/users/templates/users/aff_users.html index ed17f82e..d9cfaab7 100644 --- a/users/templates/users/aff_users.html +++ b/users/templates/users/aff_users.html @@ -5,27 +5,25 @@ Nom Pseudo Inscrit le - Etat + Connexion Profil - {% for user in users_list %} + {% for donnee in users_list %} - {{ user.name }} - {{ user.surname }} - {{ user.pseudo }} - {{ user.registered }} - {% if user.state == 0 %} - Actif - {% elif user.state == 1 %} - Désactivé + {{ donnee.0.name }} + {{ donnee.0.surname }} + {{ donnee.0.pseudo }} + {{ donnee.0.registered }} + {% if donnee.1 == True %} + Active {% else %} - Archivé + Désactivée {% endif %}
{% csrf_token %} - +
diff --git a/users/views.py b/users/views.py index b66561ce..0bb8fd16 100644 --- a/users/views.py +++ b/users/views.py @@ -145,7 +145,10 @@ def edit_ban(request, banid): def index(request): users_list = User.objects.order_by('pk') - return render(request, 'users/index.html', {'users_list': users_list}) + connexion = [] + for user in users_list: + connexion.append([user, has_access(user)]) + return render(request, 'users/index.html', {'users_list': connexion}) def profil(request): if request.method == 'POST':