Verified Commit b8bbd0d4 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Make group members distinct

parent 51c7665c
from rest_framework import serializers
from activemembers.models import MemberGroup
from activemembers.models import MemberGroup, MemberGroupMembership
from members.models import Member
......@@ -16,8 +16,8 @@ class NextCloudGroupSerializer(serializers.ModelSerializer):
model = MemberGroup
fields = ('pk', 'name', 'members')
members = serializers.SlugRelatedField(
many=True,
read_only=True,
slug_field='username'
)
members = serializers.SerializerMethodField()
def get_members(self, obj):
return (MemberGroupMembership.active_objects.filter(group=obj)
.values_list('member__username', flat=True))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment