8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 03:43:12 +00:00

Collision entre request_user et user

This commit is contained in:
Gabriel Detraz 2016-07-10 04:14:47 +02:00
parent ed9ff021ca
commit 8887eaf48c
2 changed files with 23 additions and 6 deletions

View file

@ -0,0 +1,17 @@
def context_user(request):
user = request.user
is_cableur = user.has_perms(('cableur',))
is_bureau = user.has_perms(('bureau',))
is_bofh = user.has_perms(('bofh',))
is_trez = user.has_perms(('trésorier',))
is_infra = user.has_perms(('infra',))
return {
'request_user': user,
'is_cableur': is_cableur,
'is_bureau': is_bureau,
'is_bofh': is_bofh,
'is_trez': is_trez,
'is_infra': is_infra,
}

View file

@ -85,12 +85,12 @@
</div> </div>
<div class="col-sm-2 sidenav"> <div class="col-sm-2 sidenav">
<div class="well"> <div class="well">
{% if user.is_authenticated %} {% if request_user.is_authenticated %}
<li>{{ user.name }} {{ user.surname }}</li> <li>{{ request_user.name }} {{ request_user.surname }}</li>
<li>Pseudo : {{ user.pseudo }}</li> <li>Pseudo : {{ request_user.pseudo }}</li>
<li>Chambre : {{ user.room }}</li> <li>Chambre : {{ request_user.room }}</li>
<li>Connexion : {% if user.actif == True %}<font color="green">Active</font>{% else %}<font color="red">Désactivée</font>{% endif %}</li> <li>Connexion : {% if request_user.actif == True %}<font color="green">Active</font>{% else %}<font color="red">Désactivée</font>{% endif %}</li>
<li>Fin d'adhésion : {% if user.end_adhesion != None %}<font color="green">{{ user.end_adhesion }}</font>{% else %}<font color="red">Non adhérent</font>{% endif %}</li> <li>Fin d'adhésion : {% if request_user.end_adhesion != None %}<font color="green">{{ user.end_adhesion }}</font>{% else %}<font color="red">Non adhérent</font>{% endif %}</li>
<p><a href="{% url "users:mon-profil" %}">Voir mon profil</a></p> <p><a href="{% url "users:mon-profil" %}">Voir mon profil</a></p>
{% else %} {% else %}
<p>Vous n'êtes pas authentifié</p> <p>Vous n'êtes pas authentifié</p>