8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-26 22:52:26 +00:00

Couleurs dans le profil et ajout d'informations

This commit is contained in:
Dalahro 2016-07-03 19:48:46 +02:00
parent 4d5c0af487
commit 2aa8138187
7 changed files with 45 additions and 3 deletions

View file

@ -110,6 +110,7 @@ class StateForm(ModelForm):
model = User model = User
fields = ['state'] fields = ['state']
class SchoolForm(ModelForm): class SchoolForm(ModelForm):
class Meta: class Meta:
model = School model = School

View file

@ -5,6 +5,7 @@
<th>Nom</th> <th>Nom</th>
<th>Pseudo</th> <th>Pseudo</th>
<th>Inscrit le</th> <th>Inscrit le</th>
<th>Etat</th>
<th>Profil</th> <th>Profil</th>
</tr> </tr>
</thead> </thead>
@ -14,6 +15,14 @@
<td>{{ user.surname }}</td> <td>{{ user.surname }}</td>
<td>{{ user.pseudo }}</td> <td>{{ user.pseudo }}</td>
<td>{{ user.registered }}</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>
{% else %}
<font color="orange">Archivé</font>
{% endif %}
</td>
<td><form method="POST" action="{% url "users:profil"%}"> <td><form method="POST" action="{% url "users:profil"%}">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="user" id="user" value="{{ user.pseudo }}"></input> <input type="hidden" name="user" id="user" value="{{ user.pseudo }}"></input>

View file

@ -33,8 +33,37 @@
<th>Chambre</th> <th>Chambre</th>
<td>{{ user.room }}</td> <td>{{ user.room }}</td>
<th>Date d'inscription</th> <th>Date d'inscription</th>
<td>{{ user.registered}}</td> <td>{{ user.registered }}</td>
</tr> </tr>
<tr>
<th>Fin d'adhésion</th>
{% if end_adhesion != None %}
<td><font color="green">{{ end_adhesion }}</font></td>
{% else %}
<td><font color="red">Non adhérent</font></td>
{% endif %}
<th>Bannissement</th>
{% if end_ban != None %}
<td><font color="red">{{ end_ban }}</font></td>
{% else %}
<td><font color="green">Non banni</font></td>
{% endif %}
</tr>
<tr>
<th>Connexion</th>
{% if actif == True %}
<td><font color="green">Active</font></td>
{% else %}
<td><font color="red">Désactivée</font></td>
{% endif %}
<th>Statut</th>
{% if user.state == 0 %}
<td><font color="green">Actif</font></td>
{% elif user.state == 1 %}
<td><font color="red">Désactivé</font></td>
{% else %}
<td><font color="orange">Archivé</font></td>
{% endif %}
</table> </table>
<h2>Machines :</h2> <h2>Machines :</h2>
{% if machine_list %} {% if machine_list %}

View file

@ -14,7 +14,7 @@ from cotisations.models import Facture
from machines.models import Machine from machines.models import Machine
from users.forms import PassForm from users.forms import PassForm
from search.models import SearchForm from search.models import SearchForm
from cotisations.views import is_adherent from cotisations.views import is_adherent, end_adhesion
from re2o.login import makeSecret, hashNT from re2o.login import makeSecret, hashNT
@ -156,7 +156,10 @@ def profil(request):
machines = None machines = None
factures = Facture.objects.filter(user__pseudo = users) factures = Facture.objects.filter(user__pseudo = users)
bans = Ban.objects.filter(user__pseudo = users) bans = Ban.objects.filter(user__pseudo = users)
return render(request, 'users/profil.html', {'user': users, 'machine_list' :machines, 'facture_list':factures, 'ban_list':bans}) end = None
if(is_ban(users)):
end=end_ban(users)
return render(request, 'users/profil.html', {'user': users, 'machine_list' :machines, 'facture_list':factures, 'ban_list':bans, 'end_ban':end, 'end_adhesion':end_adhesion(users), 'actif':has_access(users)})
return redirect("/users/") return redirect("/users/")
return redirect("/users/") return redirect("/users/")