return QuerySetProxy(filtered_books)
+class BookPreviewHandler(BookDetailHandler):
+ def read(self, request):
+ return Book.objects.filter(preview=True)
+
+
# add categorized tags fields for Book
def _tags_getter(category):
@classmethod
return rc.NOT_FOUND
return {'likes': likes(request.user, book)}
- def create(self, request, slug, action='like'):
+ def create(self, request, slug):
if not request.user.is_authenticated():
return rc.FORBIDDEN
try:
book = Book.objects.get(slug=slug)
except Book.DoesNotExist:
return rc.NOT_FOUND
+ action = request.GET.get('action', 'like')
if action == 'like':
book.like(request.user)
elif action == 'unlike':