In the following serializer, I have a nested serializer [ContainerSerializer
] field and I want to exclude a field from (container)ContainerSerializer
b
Create another serializer say BLContainerSerializer
and exclude fields there. Then use this in your BLcontainerMergedSerializer
. Hope this helps.
class BLContainerSerializer(serializers.ModelSerializer):
class Meta:
model = Container
exclude = ('field1', )
class BLcontainerMergedSerializer(serializers.ModelSerializer):
container = BLContainerSerializer()
class Meta:
model = BLcontainer