X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/65c9feda79d2b2c94cb7dcd561318a83fd796f0a..16358b72e70a109652609551c0ad89aec28fc58b:/src/catalogue/api/views.py diff --git a/src/catalogue/api/views.py b/src/catalogue/api/views.py index ee9f07403..c98695094 100644 --- a/src/catalogue/api/views.py +++ b/src/catalogue/api/views.py @@ -142,15 +142,23 @@ class BookDetail(RetrieveAPIView): serializer_class = serializers.BookDetailSerializer +@vary_on_auth # Because of embargo links. class EbookList(BookList): serializer_class = serializers.EbookSerializer @vary_on_auth # Because of 'liked'. class Preview(ListAPIView): - queryset = Book.objects.filter(preview=True) + #queryset = Book.objects.filter(preview=True) serializer_class = serializers.BookPreviewSerializer + def get_queryset(self): + qs = Book.objects.filter(preview=True) + # FIXME: temporary workaround for a problem with iOS app. + if 'Darwin' in self.request.META['HTTP_USER_AGENT']: + qs = qs.none() + return qs + @vary_on_auth # Because of 'liked'. class FilterBookList(ListAPIView):