fix 'liked'
authorJan Szejko <janek37@gmail.com>
Mon, 27 Aug 2018 12:36:32 +0000 (14:36 +0200)
committerJan Szejko <janek37@gmail.com>
Mon, 27 Aug 2018 12:36:32 +0000 (14:36 +0200)
src/api/handlers.py

index 9fb2886..2a12ec4 100644 (file)
@@ -282,7 +282,7 @@ class BooksHandler(BookDetailHandler):
     # hack, because piston is stupid
     @classmethod
     def liked(cls, book):
-        return book.liked
+        return getattr(book, 'liked', None)
 
     def read(self, request, **kwargs):
         books = AnonymousBooksHandler().read(request, **kwargs)
@@ -424,7 +424,7 @@ class FilterBooksHandler(BooksHandler):
     # hack, because piston is stupid
     @classmethod
     def liked(cls, book):
-        return book.liked
+        return getattr(book, 'liked', None)
 
     def read(self, request):
         qsp = AnonFilterBooksHandler().read(request)
@@ -749,7 +749,7 @@ class UserShelfHandler(BookDetailHandler):
     # hack, because piston is stupid
     @classmethod
     def liked(cls, book):
-        return book.liked
+        return getattr(book, 'liked', None)
 
     def read(self, request, state):
         if not request.user.is_authenticated():