X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/891c65c58eef499c1ffc3a5fe690e1b6bff0f0db..b0fadf2591f3af957c1c8e0307d0bcef9e9f8538:/src/search/views.py diff --git a/src/search/views.py b/src/search/views.py index b6e290b87..e5eb3a274 100644 --- a/src/search/views.py +++ b/src/search/views.py @@ -85,15 +85,19 @@ def hint(request, mozhint=False, param='term'): for author in authors[:limit] ] if len(data) < limit: - data += [ - { - 'label': b.title, - 'author': b.author_unicode(), - 'id': b.id, - 'url': b.get_absolute_url() - } - for b in Book.objects.filter(findable=True, title__iregex='\m' + prefix)[:limit-len(data)] - ] + for b in Book.objects.filter(findable=True, title__iregex='\m' + prefix)[:limit-len(data)]: + author_str = b.author_unicode() + translator = b.translator() + if translator: + author_str += ' (tłum. ' + translator + ')' + data.append( + { + 'label': b.title, + 'author': author_str, + 'id': b.id, + 'url': b.get_absolute_url() + } + ) if mozhint: data = [