X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/1a407848c86505b6491a2d11a269782154fd8582..f546d1dd07dd4d86e1dcde26a1b02f0ffe783f7c:/src/catalogue/api/fields.py?ds=inline diff --git a/src/catalogue/api/fields.py b/src/catalogue/api/fields.py index 371da38ad..d95c3a857 100644 --- a/src/catalogue/api/fields.py +++ b/src/catalogue/api/fields.py @@ -14,8 +14,10 @@ class BookLiked(serializers.ReadOnlyField): def to_representation(self, value): request = self.context['request'] if not hasattr(request, 'liked_books'): - if request.user.is_authenticated(): - request.liked_books = set(Book.tagged.with_any(request.user.tag_set.all()).values_list('id', flat=True)) + if request.user.is_authenticated: + request.liked_books = set( + Book.tagged.with_any(request.user.tag_set.all()).values_list('id', flat=True) + ) else: request.liked_books = None if request.liked_books is not None: