from rest_framework import serializers

from sigma_core.models.cluster import Cluster
from sigma_core.serializers.group import GroupSerializer

class BasicClusterSerializer(serializers.ModelSerializer):
    """
    Serialize Cluster model without memberships.
    """
    class Meta:
        model = Cluster
        exclude = ('resp_group',
            'req_rank_invite',
            'req_rank_kick',
            'req_rank_accept_join_requests',
            'req_rank_promote',
            'req_rank_demote',
            'req_rank_modify_group_infos',
            'default_member_rank',
            'protected',
            'private')


from sigma_core.serializers.user import UserWithPermsSerializer
class ClusterSerializer(BasicClusterSerializer):
    """
    Serialize Cluster model with memberships.
    """
    class Meta(BasicClusterSerializer.Meta):
        pass

    users = UserWithPermsSerializer(read_only=True, many=True)

from rest_framework import serializers

from sigma_core.models.cluster import Cluster
from sigma_core.serializers.group import GroupSerializer

class BasicClusterSerializer(serializers.ModelSerializer):
    """
    Serialize Cluster model without memberships.
    """
    class Meta:
        model = Cluster
        exclude = ('resp_group',
            'req_rank_invite',
            'req_rank_kick',
            'req_rank_accept_join_requests',
            'req_rank_promote',
            'req_rank_demote',
            'req_rank_modify_group_infos',
            'default_member_rank',
            'protected',
            'private')


class ClusterSerializer(BasicClusterSerializer):
    """
    Serialize Cluster model with memberships.
    """
    class Meta(BasicClusterSerializer.Meta):
        pass

    users_ids = serializers.PrimaryKeyRelatedField(read_only=True, many=True, source='users')

Use only foreign keys in Cluster serialisation and add _id suffixes
Use only foreign keys in Cluster serialisation and add _id suffixes
