X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c8fbdd51cb21e69bccf86cfe4b53fa307e6edcb2..bcd038fcea6b45b29ff3831b31f758dcec6b4157:/apps/search/templatetags/search_tags.py diff --git a/apps/search/templatetags/search_tags.py b/apps/search/templatetags/search_tags.py index 8ae648d1d..32d5b64c5 100644 --- a/apps/search/templatetags/search_tags.py +++ b/apps/search/templatetags/search_tags.py @@ -25,7 +25,6 @@ register = template.Library() @register.inclusion_tag('catalogue/book_searched.html', takes_context=True) def book_searched(context, result): book = Book.objects.get(pk=result.book_id) - vals = book_wide(context, book) # snippets = [] # for hit in result.hits: @@ -36,10 +35,15 @@ def book_searched(context, result): # We don't need hits which lead to sections but do not have # snippets. - vals['hits'] = filter(lambda h: 'fragment' in h or - h['snippets'], result.hits) + hits = filter(lambda h: 'fragment' in h or + h['snippets'], result.hits) - for hit in vals['hits']: + for hit in hits: hit['snippets'] = map(lambda s: s.replace("\n", "
").replace('---', '—'), hit['snippets']) - return vals + return { + 'related': book.related_info(), + 'book': book, + 'request': context.get('request'), + 'hits': hits, + }