mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-09-12 01:03:09 +00:00
Merge branch 'mailing_groups' into 'dev'
Add group mailings See merge request federez/re2o!482
This commit is contained in:
commit
eb48572162
1 changed files with 9 additions and 0 deletions
|
@ -30,6 +30,7 @@ import datetime
|
|||
|
||||
from django.conf import settings
|
||||
from django.db.models import Q
|
||||
from django.contrib.auth.models import Group
|
||||
from rest_framework import viewsets, generics, views
|
||||
from rest_framework.authtoken.models import Token
|
||||
from rest_framework.authtoken.views import ObtainAuthToken
|
||||
|
@ -759,7 +760,15 @@ class StandardMailingView(views.APIView):
|
|||
adherents_data = serializers.MailingMemberSerializer(
|
||||
all_has_access(), many=True
|
||||
).data
|
||||
|
||||
data = [{"name": "adherents", "members": adherents_data}]
|
||||
groups = Group.objects.all()
|
||||
for group in groups:
|
||||
group_data = serializers.MailingMemberSerializer(
|
||||
group.user_set.all(), many=True
|
||||
).data
|
||||
data.append({"name": group.name, "members": group_data})
|
||||
|
||||
paginator = self.pagination_class()
|
||||
paginator.paginate_queryset(data, request)
|
||||
return paginator.get_paginated_response(data)
|
||||
|
|
Loading…
Reference in a new issue