X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/d2a9ebf1eae1ee5fa8a09a7dfea76995274f7716..8a3885e1467e4c441721eaae608755a9fd10b33f:/src/opds/views.py?ds=sidebyside diff --git a/src/opds/views.py b/src/opds/views.py index 561eb9978..3862c5cd9 100644 --- a/src/opds/views.py +++ b/src/opds/views.py @@ -77,15 +77,15 @@ class OPDSFeed(Atom1Feed): link_rel = "subsection" link_type = "application/atom+xml" - _book_parent_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book-parent.png")), str)() + _book_parent_img = lazy(lambda: full_url(os.path.join(settings.PROJECT_DIR, "static/img/book-parent.png")), str)() try: - _book_parent_img_size = str(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book-parent.png"))) + _book_parent_img_size = str(os.path.getsize(os.path.join(settings.PROJECT_DIR, "static/img/book-parent.png"))) except OSError: _book_parent_img_size = '' - _book_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book.png")), str)() + _book_img = lazy(lambda: full_url(os.path.join(settings.PROJECT_DIR, "static/img/book.png")), str)() try: - _book_img_size = str(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book.png"))) + _book_img_size = str(os.path.getsize(os.path.join(settings.PROJECT_DIR, "static/img/book.png"))) except OSError: _book_img_size = '' @@ -444,8 +444,10 @@ class SearchFeed(AcquisitionFeed): ).filter(search_vector=UnaccentSearchQuery(criteria['categories'], config=settings.SEARCH_CONFIG)) books = books.filter(tag_relations__tag__in=tags) if criteria['translator']: - # TODO - pass + authors = Tag.objects.filter(category='author').annotate( + search_vector=UnaccentSearchVector('name_pl') + ).filter(search_vector=UnaccentSearchQuery(criteria['translator'], config=settings.SEARCH_CONFIG)) + books = books.filter(translators__in=authors) if criteria['title']: books = books.filter( search_vector=UnaccentSearchQuery(criteria['title'], config=settings.SEARCH_CONFIG)