Updates the decorators

This commit is contained in:
Martin Pépin 2017-02-11 17:21:59 +01:00
parent 6c3e1bd2db
commit 3365d7b9a1
2 changed files with 10 additions and 10 deletions

View file

@ -9,8 +9,8 @@ from django_cas_ng.decorators import user_passes_test
def is_cof(user):
try:
profile = user.profile
return profile.is_cof
cofprofile = user.profile.cof
return cofprofile.is_cof
except:
return False
@ -21,8 +21,8 @@ cof_required_customdenied = user_passes_test(lambda u: is_cof(u),
def is_buro(user):
try:
profile = user.profile
return profile.is_buro
cofprofile = user.profile.cof
return cofprofile.is_buro
except:
return False

View file

@ -7,7 +7,7 @@
<div class="container hidden-xs espace"></div>
<div class="container">
<div class="home-menu row">
<div class="{% if user.profile.is_buro %}col-sm-6 {% else %}col-sm-8 col-sm-offset-2 col-xs-12 {%endif%}normal-user-hm">
<div class="{% if user.profile.cof.is_buro %}col-sm-6 {% else %}col-sm-8 col-sm-offset-2 col-xs-12 {%endif%}normal-user-hm">
<!-- {% if open_events %}
<h3 class="block-title">Événements<span class="pull-right glyphicon glyphicon-calendar"></span></h3>
<div class="hm-block">
@ -30,7 +30,7 @@
{% endif %}
{% if user.profile.is_cof %}
{% if user.profile.cof.is_cof %}
{% if open_tirages %}
<h3 class="block-title">Tirages du BdA<span class="pull-right glyphicon glyphicon-th-list"></span></h3>
<div class="hm-block">
@ -55,15 +55,15 @@
<div class="hm-block">
<ul>
<li><a href="{% url "cof.views.calendar" %}">Calendrier dynamique</a></li>
{% if user.profile.is_cof %}<li><a href="{% url "petits-cours-inscription" %}">Inscription pour donner des petits cours</a></li>{% endif %}
{% if user.profile.cof.is_cof %}<li><a href="{% url "petits-cours-inscription" %}">Inscription pour donner des petits cours</a></li>{% endif %}
<li><a href="{% url "cof.views.profile" %}">Éditer mon profil</a></li>
<li><a href="{% url "profile" %}">Éditer mon profil</a></li>
{% if not user.profile.login_clipper %}<li><a href="{% url "django.contrib.auth.views.password_change" %}">Changer mon mot de passe</a></li>{% endif %}
</ul>
</div>
{% endif %}
</div>
{% if user.profile.is_buro %}
{% if user.profile.cof.is_buro %}
<div class="col-sm-6 buro-user-hm">
<h3 class="block-title">Administration<span class="pull-right glyphicon glyphicon-cog"></span></h3>
<div class="hm-block">
@ -113,7 +113,7 @@
{% endif %}
</div> <!-- /.row.home-menu -->
<div class="container hidden-xs espace"></div>
{% if not user.profile.is_buro %}
{% if not user.profile.cof.is_buro %}
<div class="home-menu row row-centered">
<div class="col-sm-8 col-sm-offset-2 col-xs-12 normal-user-hm">
<div class="foot-banner">