Salim Elliye 2 weeks ago
parent eca4cf02b5
commit 27471ae5a3

@ -74,4 +74,16 @@ class ProjectSerializer(serializers.ModelSerializer):
class Meta:
model = Project
fields = "__all__"
fields = "__all__"
def to_representation(self, instance):
representation = super().to_representation(instance)
# Exclude manager from members list
manager_id = representation.get("manager", {}).get("id")
if manager_id:
representation["members"] = [
member for member in representation["members"]
if member.get("id") != manager_id
]
return representation
Loading…
Cancel
Save