forked from DGNum/gestioCOF
BDS: members email export
This commit is contained in:
parent
3b98f35773
commit
e025ae2d96
3 changed files with 18 additions and 2 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#todo">Chercher une personne</a></li>
|
<li><a href="#todo">Chercher une personne</a></li>
|
||||||
<li><a href="#todo">Exporter une liste des membres</a></li>
|
<li><a href="{% url 'bds:members_emails' %}">Emails des adhérent⋅e⋅s</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -3,4 +3,8 @@ from django.urls import path
|
||||||
from bds import views
|
from bds import views
|
||||||
|
|
||||||
app_name = "bds"
|
app_name = "bds"
|
||||||
urlpatterns = [path("", views.home, name="home")]
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("", views.home, name="home"),
|
||||||
|
path("members/emails", views.members_emails, name="members_emails"),
|
||||||
|
]
|
||||||
|
|
12
bds/views.py
12
bds/views.py
|
@ -1,6 +1,10 @@
|
||||||
|
from django.contrib.auth.decorators import permission_required
|
||||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||||
|
from django.http import HttpResponse
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
from bds.models import BDSProfile
|
||||||
|
|
||||||
|
|
||||||
class HomeView(PermissionRequiredMixin, TemplateView):
|
class HomeView(PermissionRequiredMixin, TemplateView):
|
||||||
permission_required = "bds:is_team"
|
permission_required = "bds:is_team"
|
||||||
|
@ -8,3 +12,11 @@ class HomeView(PermissionRequiredMixin, TemplateView):
|
||||||
|
|
||||||
|
|
||||||
home = HomeView.as_view()
|
home = HomeView.as_view()
|
||||||
|
|
||||||
|
|
||||||
|
@permission_required("bds:is_staff")
|
||||||
|
def members_emails(request):
|
||||||
|
members = BDSProfile.objects.filter(is_member=True)
|
||||||
|
response = HttpResponse(content_type="text/plain")
|
||||||
|
response.write(", ".join(members.values_list("user__email", flat=True)))
|
||||||
|
return response
|
||||||
|
|
Loading…
Reference in a new issue