mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 23:43:47 +00:00
Ajout de l'état de la connexion dans les affichages d'utilisateur
This commit is contained in:
parent
6c7d3c2213
commit
4635ee05c8
6 changed files with 19 additions and 14 deletions
Binary file not shown.
Binary file not shown.
|
@ -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)
|
||||
|
|
Binary file not shown.
|
@ -5,27 +5,25 @@
|
|||
<th>Nom</th>
|
||||
<th>Pseudo</th>
|
||||
<th>Inscrit le</th>
|
||||
<th>Etat</th>
|
||||
<th>Connexion</th>
|
||||
<th>Profil</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for user in users_list %}
|
||||
{% for donnee in users_list %}
|
||||
<tr>
|
||||
<td>{{ user.name }}</td>
|
||||
<td>{{ user.surname }}</td>
|
||||
<td>{{ user.pseudo }}</td>
|
||||
<td>{{ user.registered }}</td>
|
||||
<td>{% if user.state == 0 %}
|
||||
<font color="green">Actif</font>
|
||||
{% elif user.state == 1 %}
|
||||
<font color="red">Désactivé</font>
|
||||
<td>{{ donnee.0.name }}</td>
|
||||
<td>{{ donnee.0.surname }}</td>
|
||||
<td>{{ donnee.0.pseudo }}</td>
|
||||
<td>{{ donnee.0.registered }}</td>
|
||||
<td>{% if donnee.1 == True %}
|
||||
<font color="green">Active</font>
|
||||
{% else %}
|
||||
<font color="orange">Archivé</font>
|
||||
<font color="red">Désactivée</font>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><form method="POST" action="{% url "users:profil"%}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" id="user" value="{{ user.pseudo }}"></input>
|
||||
<input type="hidden" name="user" id="user" value="{{ donnee.0.pseudo }}"></input>
|
||||
<button class="btn btn-primary btn-sm" type="submit"><i class="glyphicon glyphicon-tree-deciduous"></i></button>
|
||||
</form>
|
||||
</td>
|
||||
|
|
|
@ -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':
|
||||
|
|
Loading…
Reference in a new issue