Browse Source

Couleurs dans le profil et ajout d'informations

rewrite_authors
Dalahro 10 years ago
parent
commit
2aa8138187
  1. BIN
      users/__pycache__/models.cpython-34.pyc
  2. BIN
      users/__pycache__/urls.cpython-34.pyc
  3. BIN
      users/__pycache__/views.cpython-34.pyc
  4. 1
      users/models.py
  5. 9
      users/templates/users/aff_users.html
  6. 31
      users/templates/users/profil.html
  7. 7
      users/views.py

BIN
users/__pycache__/models.cpython-34.pyc

Binary file not shown.

BIN
users/__pycache__/urls.cpython-34.pyc

Binary file not shown.

BIN
users/__pycache__/views.cpython-34.pyc

Binary file not shown.

1
users/models.py

@ -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

9
users/templates/users/aff_users.html

@ -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>

31
users/templates/users/profil.html

@ -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 %}

7
users/views.py

@ -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/")

Loading…
Cancel
Save