X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/75957f735219259d3b4bc361f80ccd3d7b92a0e9..1227b1201c537ea17e310f0faab4ead7cf0d25af:/src/catalogue/views.py diff --git a/src/catalogue/views.py b/src/catalogue/views.py index ccd51ff68..cfed6ca4e 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -19,6 +19,7 @@ from django.views.decorators.cache import never_cache from ajaxable.utils import AjaxableFormView from club.models import Membership +from annoy.models import DynamicTextInsert from pdcounter import views as pdcounter_views from picture.models import Picture, PictureArea from catalogue import constants @@ -312,7 +313,14 @@ def book_text(request, slug): if not book.has_html_file(): raise Http404 - return render(request, 'catalogue/book_text.html', {'book': book}) + with book.html_file.open('r') as f: + book_text = f.read() + + return render(request, 'catalogue/book_text.html', { + 'book': book, + 'book_text': book_text, + 'inserts': DynamicTextInsert.objects.all() + }) # ========= @@ -457,4 +465,4 @@ def ridero_cover(request, slug): def get_isbn(request, book_format, slug): book = Book.objects.get(slug=slug) - return HttpResponse(book.extra_info.get('isbn_%s' % book_format)) + return HttpResponse(book.get_extra_info_json().get('isbn_%s' % book_format))