From 4635ee05c8f92433632ad44e1532b5d4bfbe484c Mon Sep 17 00:00:00 2001 From: Dalahro Date: Sun, 3 Jul 2016 21:35:50 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20l'=C3=A9tat=20de=20la=20connexion?= =?UTF-8?q?=20dans=20les=20affichages=20d'utilisateur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cotisations/__pycache__/views.cpython-34.pyc | Bin 3669 -> 3669 bytes search/__pycache__/views.cpython-34.pyc | Bin 1685 -> 1819 bytes search/views.py | 6 ++++- users/__pycache__/views.cpython-34.pyc | Bin 6640 -> 6723 bytes users/templates/users/aff_users.html | 22 +++++++++---------- users/views.py | 5 ++++- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cotisations/__pycache__/views.cpython-34.pyc b/cotisations/__pycache__/views.cpython-34.pyc index 4fbbb82e5c1b2390d67e8cc0adf8048d716acd88..03ffb108669af838aa6ab001ffba3d965a7de535 100644 GIT binary patch delta 28 icmcaAb5(}@9S<+pqVUR%>?OR6wHx`=ylViK!3voG delta 28 icmcaAb5(}@9S<*8c~Heh_7YyksL3_FIzVzI?-~G$B?)K% diff --git a/search/__pycache__/views.cpython-34.pyc b/search/__pycache__/views.cpython-34.pyc index 9d6cc7253a1fc05cf2590348ee4182dd3b724bed..da15f32665fd982ee74eb83bfe3b2b2febf9531e 100644 GIT binary patch delta 674 zcmY*WO>fgc5Pjp=&X=87K$2FXYEgw~5O8b6p&$fE+_)5}A`+^M?bZ&7lX@LUB}YB9 z{D8{p0l0AD#4kXCU%>(Gl`HTYm~|smb~SHipJ(UItk3KZjrBj4UHcdw?tC$UpSZ9z zjvugz@2BgZZv%b}!xlzu^xGi64&TBF(C@&v;WvtS34RmXUFY=IyGEB}Ep)}M>v@3? z`CEEV?R-t!*m6`&76Ztn%akl}H1&a~)X;gDNr|X-(lVVP8{72S?cPIp4^CYa7o@q;(8T49dt%^?hDO zYW>etklKifl71Dv%uw_9vNCw`URF`l_jqt_@3@5R)Xt;Qs{MpmMAaj{ou8Gytw?L+ zdSMg?yTeGN(%N&qbeb$q`9#0xG^9BS(s1l24W2n!&cEutBWb#mNf7%9881cP*xV=Lh3KwSR`##v4D<> zt~0dQ#2Rk0qb9Y;BAYh(H`%np*riLnZ&62UQIY<%yPVIAAJ6;sqK7-Lqu`A=?^$(P j$^y;bWG_V zKo$e-*tI(wUHB0wD;on+_YQqNA_TU+_db92`|RhR)w6KvE(j}sUVYtN^ne>Y8iM%- zBfUCZ`n^zr^6?!=VyFNrEO-N|ik(*N^xwJpML#Gu>tcDYW{cPjAdl*#o6Ndo*E~uL z$=GD1uUXB30iXz<1az4)Dindwi%`IraKZ{<;9v~szc5$go#dSp$GmZt-@C|WFz_%a zA$N=85?SS`;vw_VcaaOI8MJc;s=`UymfE>z8)|b${F1SQoy<2E&Wo@~57)DD<6JHz z!LZXk=pXg=5Bq7B1Rp!yY^0|vbLp-{!NeQ(vV&u#tK6QRGrnxsb!fS7gZ+tCN!LwB z*7wU(w{#-EjC%T8Ql1*7iTj~*lLSLt-IFOnn%>2h@Ol498n|!`5!gnW%&RA 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 ddf075bdad891b9d0370a48a7f5e32dd33ea2b3a..d26307507fdf07ad3015763ada9f29cac55aeb94 100644 GIT binary patch delta 250 zcmexheAtBZ9S<+p`CM*@iw28Jv~hAbwA6h?+-Muu8O zhI9soS|)}Hb%q*72A5cQhFWHZ8YYG;Aj!;7!U7_J>e87&Bx9jGLwE@*Lk$B%3KK&n zBT(Vw*CGaXY(>04ql=V)#4V2eqLkF4_@v5PY>5R0sd*_ydLTI_Afd@pWDH^l0EsBh zcAK{B3^9RM1`HiiHI delta 171 zcmX?X^1+z%9S<*8gI8sE*hbEcB8E&13=C{Q>fHymq{aK 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':