X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/033aad30ca189472af0e04309cab1bc5964c9119..174cf7969627acdc1642f2eda012499b218abac8:/src/catalogue/api/serializers.py diff --git a/src/catalogue/api/serializers.py b/src/catalogue/api/serializers.py index 99a634675..06832e794 100644 --- a/src/catalogue/api/serializers.py +++ b/src/catalogue/api/serializers.py @@ -106,7 +106,7 @@ class BookDetailSerializer(LegacyMixin, serializers.ModelSerializer): class Meta: model = Book fields = [ - 'title', 'url', + 'title', 'url', 'language', 'epochs', 'genres', 'kinds', 'authors', 'translators', 'fragment_data', 'children', 'parent', 'preview', 'epub', 'mobi', 'pdf', 'html', 'txt', 'fb2', 'xml', 'media', 'audio_length', @@ -147,12 +147,13 @@ class CollectionListSerializer(serializers.ModelSerializer): class CollectionSerializer(serializers.ModelSerializer): - books = BookSerializer(many=True, source='get_books') + books = BookSerializer(many=True, source='get_books', read_only=True) + book_slugs = serializers.CharField(write_only=True) url = AbsoluteURLField() class Meta: model = Collection - fields = ['url', 'books', 'description', 'title'] + fields = ['url', 'books', 'description', 'title', 'book_slugs'] class FragmentSerializer(serializers.ModelSerializer):