mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Collision entre request_user et user
This commit is contained in:
parent
adefbd8af3
commit
e53e0a7dd0
2 changed files with 23 additions and 6 deletions
17
re2o/context_processors.py
Normal file
17
re2o/context_processors.py
Normal 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,
|
||||||
|
}
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue