In Django Rest Framework, how do I serialize values to an array of values rather than an array of objects? Here is a sample of my serializer code:
class NodeTagSerializer(serializers.ModelSerializer):
class Meta:
model = NodeTag
fields = (
'name',
)
class NodeTreeSerializer(serializers.ModelSerializer):
tags = NodeTagSerializer(required=False)
class Meta:
model = NodeTree
fields = (
'tags',
)
This is returning:
"tags": [
{"name": "Tag1"},
{"name": "Tag2"}
]
But I want:
"tags": [
"Tag1",
"Tag2"
]