forked from DGNum/gestioCOF
Ajout de la liste des clubs
This commit is contained in:
parent
f25243b082
commit
ccc1c79101
3 changed files with 43 additions and 1 deletions
25
gestioncof/templates/liste_clubs.html
Normal file
25
gestioncof/templates/liste_clubs.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{% extends "base_title.html" %}
|
||||
|
||||
{% block page_size %}col-sm-8{% endblock %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h2>Clubs enregistrés sur GestioCOF</h2>
|
||||
<ul>
|
||||
{% for club in owned_clubs %}
|
||||
<li>
|
||||
<a href="{% url "membres-club" club.name %}">
|
||||
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}{% empty %}pas de respo{% endfor %})
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if other_clubs %}
|
||||
{% for club in other_clubs %}
|
||||
<li>
|
||||
<p>
|
||||
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}{% empty %}pas de respo{% endfor %})
|
||||
</p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -54,5 +54,6 @@ calendar_patterns = [
|
|||
]
|
||||
|
||||
clubs_patterns = [
|
||||
url(r'^membres/(?P<name>\w+)', views.membres_club)
|
||||
url(r'^membres/(?P<name>\w+)', views.membres_club, name='membres-club'),
|
||||
url(r'^liste', views.liste_clubs, name='liste-clubs')
|
||||
]
|
||||
|
|
|
@ -483,6 +483,11 @@ def registration(request):
|
|||
return render(request, "registration.html")
|
||||
|
||||
|
||||
# -----
|
||||
# Clubs
|
||||
# -----
|
||||
|
||||
|
||||
@login_required
|
||||
def membres_club(request, name):
|
||||
# Vérification des permissions : l'utilisateur doit être membre du burô
|
||||
|
@ -495,6 +500,17 @@ def membres_club(request, name):
|
|||
return render(request, 'membres_clubs.html', {'club': club})
|
||||
|
||||
|
||||
@cof_required
|
||||
def liste_clubs(request):
|
||||
clubs = Club.objects
|
||||
if request.user.profile.is_buro:
|
||||
data = {'owned_clubs': clubs.all()}
|
||||
else:
|
||||
data = {'owned_clubs': request.user.clubs_geres,
|
||||
'other_clubs': clubs.exclude(respos=request.user)}
|
||||
return render(request, 'liste_clubs.html', data)
|
||||
|
||||
|
||||
@buro_required
|
||||
def export_members(request):
|
||||
response = HttpResponse(content_type='text/csv')
|
||||
|
|
Loading…
Reference in a new issue