return MEDIA_BASE + default.backend.get_thumbnail(
book.cover, "139x193").url if book.cover else ''
+ @classmethod
+ def cover_source_image(cls, book):
+ url = book.cover_source()
+ return url.rstrip('/') + '/file/'
+
class BookDetailHandler(BaseHandler, BookDetails):
""" Main handler for Book objects.
class FilterBooksHandler(AnonymousBooksHandler):
- fields = book_tag_categories + ['href', 'title', 'url', 'cover', 'cover_thumb', 'slug']
+ fields = book_tag_categories + ['href', 'title', 'url', 'cover', 'cover_thumb', 'slug', 'cover_source_image']
def read(self, request, title_part=None, author_part=None, is_lektura=None, is_audiobook=None,
after=None, before=None, count=None):
is_audiobook = is_audiobook == 'true'
books = Book.objects.distinct()
if title_part:
- books = books.filter(title__icontains=title_part)
+ books = books.filter(title__iregex='\m' + title_part)
if author_part is not None:
- books = books.filter(cached_author__icontains=author_part)
+ books = books.filter(cached_author__iregex='\m' + author_part)
if is_lektura is not None:
books = books.filter(has_audience=is_lektura)
if is_audiobook is not None: