- fields = ['url', 'books', 'description', 'title']
+ fields = ['url', 'books', 'description', 'title', 'book_slugs']
+
+
+class FragmentSerializer(serializers.ModelSerializer):
+ book = BookSerializer()
+ url = AbsoluteURLField()
+ href = AbsoluteURLField(source='get_api_url')
+
+ class Meta:
+ model = Fragment
+ fields = ['book', 'url', 'anchor', 'href']
+
+
+class FragmentDetailSerializer(serializers.ModelSerializer):
+ book = BookSerializer()
+ url = AbsoluteURLField()
+ themes = TagSerializer(many=True)
+
+ class Meta:
+ model = Fragment
+ fields = ['book', 'anchor', 'text', 'url', 'themes']