diff --git a/cof/urls.py b/cof/urls.py
index 5a4a49dc..750107fb 100644
--- a/cof/urls.py
+++ b/cof/urls.py
@@ -16,7 +16,8 @@ from django.contrib.auth import views as django_views
from django_cas_ng import views as django_cas_views
from gestioncof import views as gestioncof_views, csv_views
from gestioncof.urls import export_patterns, petitcours_patterns, \
- surveys_patterns, events_patterns, calendar_patterns
+ surveys_patterns, events_patterns, calendar_patterns, \
+ clubs_patterns
from gestioncof.autocomplete import autocomplete
@@ -38,6 +39,8 @@ urlpatterns = [
url(r'^event/', include(events_patterns)),
# Calendrier
url(r'^calendar/', include(calendar_patterns)),
+ # Clubs
+ url(r'^clubs/', include(clubs_patterns)),
# Authentification
url(r'^cof/denied$', TemplateView.as_view(template_name='cof-denied.html'),
name="cof-denied"),
diff --git a/gestioncof/templates/membres_clubs.html b/gestioncof/templates/membres_clubs.html
new file mode 100644
index 00000000..d93e8cdb
--- /dev/null
+++ b/gestioncof/templates/membres_clubs.html
@@ -0,0 +1,20 @@
+{% extends "base_title.html" %}
+
+{% block realcontent %}
+
{{ club }}
+
+{% if club.membres.exists %}
+Liste des membres
+
+{% for member in club.membres.all %}
+
+ {{ member }} |
+ {{ member.email }} |
+
+{% endfor %}
+
+{% else %}
+Ce club ne contient actuellement aucun membre.
+{% endif %}
+
+{% endblock %}
diff --git a/gestioncof/urls.py b/gestioncof/urls.py
index 89cd5aa8..367cfbe8 100644
--- a/gestioncof/urls.py
+++ b/gestioncof/urls.py
@@ -52,3 +52,7 @@ calendar_patterns = [
url(r'^(?P[a-z0-9-]+)/calendar.ics$',
'gestioncof.views.calendar_ics')
]
+
+clubs_patterns = [
+ url(r'^membres/(?P\w+)', views.membres_club)
+]
diff --git a/gestioncof/views.py b/gestioncof/views.py
index 4e428791..247d6cad 100644
--- a/gestioncof/views.py
+++ b/gestioncof/views.py
@@ -10,7 +10,7 @@ from datetime import timedelta
from icalendar import Calendar, Event as Vevent
from django.shortcuts import redirect, get_object_or_404, render
-from django.http import Http404, HttpResponse
+from django.http import Http404, HttpResponse, HttpResponseForbidden
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import login as django_login_view
from django.contrib.auth.models import User
@@ -24,7 +24,7 @@ from gestioncof.models import Event, EventRegistration, EventOption, \
from gestioncof.models import EventCommentField, EventCommentValue, \
CalendarSubscription
from gestioncof.shared import send_custom_mail
-from gestioncof.models import CofProfile, Clipper
+from gestioncof.models import CofProfile, Clipper, Club
from gestioncof.decorators import buro_required, cof_required
from gestioncof.forms import UserProfileForm, EventStatusFilterForm, \
SurveyForm, SurveyStatusFilterForm, RegistrationUserForm, \
@@ -483,6 +483,18 @@ def registration(request):
return render(request, "registration.html")
+@login_required
+def membres_club(request, name):
+ # Vérification des permissions : l'utilisateur doit être membre du burô
+ # ou respo du club.
+ user = request.user
+ club = get_object_or_404(Club, name=name)
+ if not request.user.profile.is_buro \
+ and club not in user.clubs_geres.all():
+ return HttpResponseForbidden('Permission denied
')
+ return render(request, 'membres_clubs.html', {'club': club})
+
+
@buro_required
def export_members(request):
response = HttpResponse(content_type='text/csv')