X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/2864109d874d74c0da1bf8cae4b53edfb3636c01..6f313f26ab28a868801a725ee986341d68ca3856:/src/catalogue/views.py diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 98dafc51b..195513734 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -352,7 +352,7 @@ def _no_diacritics_regexp(query): def repl(m): l = m.group() - return u"(%s)" % '|'.join(names[l]) + return u"(?:%s)" % '|'.join(names[l]) return re.sub(u'[%s]' % (u''.join(names.keys())), repl, query) @@ -640,13 +640,14 @@ class CustomPDFFormView(AjaxableFormView): @ssi_included def book_mini(request, pk, with_link=True): - book = get_object_or_404(Book, pk=pk) - author_str = ", ".join(tag.name for tag in book.tags.filter(category='author')) + # book = get_object_or_404(Book, pk=pk) + try: + book = Book.objects.only('cover_thumb', 'title', 'language', 'slug').get(pk=pk) + except Book.DoesNotExist: + raise Http404 return render(request, 'catalogue/book_mini_box.html', { 'book': book, - 'author_str': author_str, - 'with_link': with_link, - 'show_lang': book.language_code() != settings.LANGUAGE_CODE, + 'no_link': not with_link, })