fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moving away from getpaid for now.
[wolnelektury.git]
/
src
/
catalogue
/
api
/
fields.py
diff --git
a/src/catalogue/api/fields.py
b/src/catalogue/api/fields.py
index
371da38
..
d95c3a8
100644
(file)
--- 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'):
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:
else:
request.liked_books = None
if request.liked_books is not None: