X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c15b511c1e9ebb06050f40e98ec554ba6c26cb1b..025b93b1df94c65df26c896284580f2b00756f0a:/src/catalogue/api/serializers.py diff --git a/src/catalogue/api/serializers.py b/src/catalogue/api/serializers.py index 79bb58b6c..45252a8f0 100644 --- a/src/catalogue/api/serializers.py +++ b/src/catalogue/api/serializers.py @@ -27,6 +27,10 @@ class TagDetailSerializer(serializers.ModelSerializer): fields = ['name', 'url', 'sort_key', 'description'] +class TranslatorSerializer(serializers.Serializer): + name = serializers.CharField(source='*') + + class BookSerializer(LegacyMixin, serializers.ModelSerializer): author = serializers.CharField(source='author_unicode') kind = serializers.CharField(source='kind_unicode') @@ -79,6 +83,7 @@ class BookDetailSerializer(LegacyMixin, serializers.ModelSerializer): url = AbsoluteURLField() authors = TagSerializer(many=True) + translators = TranslatorSerializer(many=True) epochs = TagSerializer(many=True) genres = TagSerializer(many=True) kinds = TagSerializer(many=True) @@ -101,11 +106,12 @@ class BookDetailSerializer(LegacyMixin, serializers.ModelSerializer): class Meta: model = Book fields = [ - 'title', 'url', - 'epochs', 'genres', 'kinds', 'authors', + 'title', 'url', 'language', + 'epochs', 'genres', 'kinds', 'authors', 'translators', 'fragment_data', 'children', 'parent', 'preview', 'epub', 'mobi', 'pdf', 'html', 'txt', 'fb2', 'xml', 'media', 'audio_length', - 'cover_color', 'simple_cover', 'cover_thumb', 'cover', 'simple_thumb' + 'cover_color', 'simple_cover', 'cover_thumb', 'cover', 'simple_thumb', + 'isbn_pdf', 'isbn_epub', 'isbn_mobi', ] legacy_non_null_fields = ['html', 'txt', 'fb2', 'epub', 'mobi', 'pdf', 'cover', 'simple_cover', 'cover_thumb', 'simple_thumb']