class TrackListingField(serializers.RelatedField):

    def to_representation(self, value):
        duration = time.strftime('%M:%S', time.gmtime(value.duration))
return 'Track %d: %s (%s)' % (value.order, value.name, duration)


class AlbumSerializer(serializers.ModelSerializer):
    tracks = TrackListingField(many=True)


class Meta:
    pass
AttributeError с Django REST Framework и отношением ManyToMany