Merge remote-tracking branch 'origin/tmp' into michele.orru/gestioCOF-supportBDS
This commit is contained in:
commit
fcf392f40d
4 changed files with 22 additions and 16 deletions
|
@ -77,7 +77,7 @@ class Command(MyBaseCommand):
|
|||
self.stdout.write("Inscription des utilisateurs aux tirages")
|
||||
ChoixSpectacle.objects.all().delete()
|
||||
choices = []
|
||||
for user in User.objects.filter(profile__is_cof=True):
|
||||
for user in User.objects.filter(profile__cof__is_cof=True):
|
||||
for tirage in tirages:
|
||||
part, _ = Participant.objects.get_or_create(
|
||||
user=user,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ from cof.petits_cours_models import (
|
|||
PetitCoursAttributionCounter
|
||||
)
|
||||
|
||||
from cof.models import CofProfile
|
||||
|
||||
# Où sont stockés les fichiers json
|
||||
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
'data')
|
||||
|
@ -47,8 +49,10 @@ class Command(MyBaseCommand):
|
|||
# Gaulois
|
||||
gaulois = self.from_json('gaulois.json', DATA_DIR, User)
|
||||
for user in gaulois:
|
||||
user.profile.is_cof = True
|
||||
user.profile.save()
|
||||
CofProfile.objects.create(
|
||||
profile=user.profile,
|
||||
is_cof=True
|
||||
)
|
||||
|
||||
# Romains
|
||||
self.from_json('romains.json', DATA_DIR, User)
|
||||
|
@ -65,10 +69,12 @@ class Command(MyBaseCommand):
|
|||
root.set_password('root')
|
||||
root.is_staff = True
|
||||
root.is_superuser = True
|
||||
root.profile.is_cof = True
|
||||
root.profile.is_buro = True
|
||||
root.profile.save()
|
||||
root.save()
|
||||
CofProfile.objects.create(
|
||||
profile=root.profile,
|
||||
is_cof=True,
|
||||
is_buro=True
|
||||
)
|
||||
|
||||
# ---
|
||||
# Petits cours
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue