def get(self, request, format=None):
        user = User.objects.get(pk=request.user.pk)
        client = Client.objects.get(user=user)
        team = Team.objects.get(client_id=client.id)
        # Find a team which include you as a team member
        team_member_ids = TeamMember.objects.filter(Q(member_email=client.user.email) & ~Q(team_id=team.id))\
            .values_list('id', flat=True).order_by('id').distinct()

        shared_profiles = SharedProfile.objects.filter(team_member_id__in=team_member_ids)
        shared_talent_ids = shared_profiles.order_by('talent_id').values_list('talent_id', flat=True).distinct()

        res = []
        for shared_talent_id in shared_talent_ids:
            talent = Talent.objects.get(id=shared_talent_id)
            talent_serializer = TalentSimpleSerializer(talent)
            shared_team_member_ids = SharedProfile.objects.filter(
                team_member_id__in=team_member_ids,
                talent_id=shared_talent_id
            )
            team_members = TeamMember.objects.filter(id__in=shared_team_member_ids)

            if len(team_members) > 0:
                team_members_serializer = TeamMemberSerializer(team_members, many=True)
                res.append({
                    'talent': talent_serializer.data,
                    'team_members': team_members_serializer.data
                })

        serializer = SharedTalentSerializer(data=res, many=True)
        return JsonResponse(res, safe=False)
class SharedProfileSharedTalent(generics.ListCreateAPIView):

    @swagger_auto_schema(responses={200: SharedTalentSerializer(many=True)})
    def get(self, request, format=None):
        user = User.objects.get(pk=request.user.pk)
        client = Client.objects.get(user=user)
        team = Team.objects.get(client_id=client.id)
        team_member_ids = TeamMember.objects.filter(team_id=team.id)\
            .values_list('id', flat=True)\
            .order_by('id')\
            .distinct()

        shared_profiles = SharedProfile.objects.filter(team_member_id__in=team_member_ids)
        shared_talent_ids = shared_profiles.order_by('talent_id').values_list('talent_id', flat=True).distinct()

        res = []
        for shared_talent_id in shared_talent_ids:
            talent = Talent.objects.get(id=shared_talent_id)
            talent_serializer = TalentSimpleSerializer(talent)
            shared_team_member_ids = SharedProfile.objects.filter(
                team_member_id__in=team_member_ids,
                talent_id=shared_talent_id
            ).order_by('team_member_id').values_list('team_member_id', flat=True).distinct()

            team_members = TeamMember.objects.filter(id__in=shared_team_member_ids)

            if len(team_members) > 0:
                team_members_serializer = TeamMemberSerializer(team_members, many=True)
                res.append({
                    'talent': talent_serializer.data,
                    'team_members': team_members_serializer.data
                })

        serializer = SharedTalentSerializer(data=res, many=True)
        return JsonResponse(res, safe=False)