X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6c0f80a0b436aa78f3245c5a0b10d5d49a9a7dec..5767a4cec1018349191a60406a82b6a4d2ae431a:/src/catalogue/views.py diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 09f48c7d4..c2636089d 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -321,7 +321,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) @@ -609,11 +609,14 @@ class CustomPDFFormView(AjaxableFormView): @ssi_included def book_mini(request, pk, with_link=True): - book = get_object_or_404(models.Book, pk=pk) - author_str = ", ".join(tag.name for tag in book.tags.filter(category='author')) + # book = get_object_or_404(models.Book, pk=pk) + try: + book = models.Book.objects.only('cover_thumb', 'title', 'language', 'slug').get(pk=pk) + except models.Book.DoesNotExist: + raise Http404 return render(request, 'catalogue/book_mini_box.html', { 'book': book, - 'author_str': author_str, + 'author': book.author_unicode(), 'with_link': with_link, 'show_lang': book.language_code() != settings.LANGUAGE_CODE, })