@piwik_track
def read(self, request, tags=None, top_level=False, audiobooks=False, daisy=False, pk=None,
recommended=False, newest=False, books=None,
- after=None, before=None, count=None):
+ after=None, count=None):
""" Lists all books with given tags.
:param tags: filtering tags; should be a path of categories
if 'after' in request.GET:
after = request.GET['after']
- if 'before' in request.GET:
- before = request.GET['before']
if 'count' in request.GET:
count = request.GET['count']
if newest:
books = books.order_by('-created_at')
+ # beznadzieja
if after:
books = books.filter(slug__gt=after)
- if before:
- books = books.filter(slug__lt=before)
books = books.only('slug', 'title', 'cover', 'cover_thumb')
for category in book_tag_categories:
books = prefetch_relations(books, category)
if count:
- if before:
- books = list(reversed(books.order_by('-slug')[:count]))
- else:
- books = books[:count]
+ books = books[:count]
return books
# 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)
# 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)
return rc.NOT_FOUND
after = request.GET.get('after')
- before = request.GET.get('before')
count = request.GET.get('count')
tags = Tag.objects.filter(category=category_sng).exclude(items=None).order_by('slug')
if after:
tags = tags.filter(slug__gt=after)
- if before:
- tags = tags.filter(slug__lt=before)
if count:
- if before:
- tags = list(reversed(tags.order_by('-slug')[:count]))
- else:
- tags = tags[:count]
+ tags = tags[:count]
return tags
# 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():