I'm trying to use the Django REST Framework JSON API and was wondering if there is a way to serialize Relations (ForeignKey and all) with a bit more detail compared to :
"post": {
"type": "Post",
"id": 1
}
I was thinking of something along the lines of :
"post": {
"type": "Post",
"id": 1,
"name": "First Post"
"tag": "Development"
}
class AlbumSerializer(serializers.ModelSerializer):
tracks = serializers.StringRelatedField(many=True)
class Meta:
model = Album
fields = ('album_name', 'artist', 'tracks')
for relations look here: http://www.django-rest-framework.org/api-guide/relations/