class FilterBooksHandler(AnonymousBooksHandler):
- fields = book_tag_categories + ['href', 'title', 'url', 'cover', 'cover_thumb', 'slug', 'cover_source_image']
+ fields = book_tag_categories + [
+ 'href', 'title', 'url', 'cover', 'cover_thumb', 'slug', 'cover_source_image', 'fragment_data']
def read(self, request, title_part=None, author_part=None, is_lektura=None, is_audiobook=None,
after=None, before=None, count=None):
else:
return None
+ def fragment_data(self):
+ fragment = self.choose_fragment()
+ if fragment:
+ return {'title': fragment.book.pretty_title(), 'html': fragment.get_short_text()}
+ else:
+ return None
+
def update_popularity(self):
count = self.tags.filter(category='set').values('user').order_by('user').distinct().count()
try: