From fb08d6c6a6dca486303ca69b5c47dd29e548fd11 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 29 Jun 2017 11:52:26 +0200 Subject: [PATCH] isbn getter --- src/catalogue/urls.py | 1 + src/catalogue/views.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/catalogue/urls.py b/src/catalogue/urls.py index 5f6f8e5a5..fb6a7b465 100644 --- a/src/catalogue/urls.py +++ b/src/catalogue/urls.py @@ -82,6 +82,7 @@ urlpatterns += patterns( 'book_fragments', name='book_fragments'), url(r'^okladka-ridero/(?P%s).png$' % SLUG, 'ridero_cover'), + url(r'^isbn/(?P(pdf|epub|mobi|txt|html))/(?P%s)/' % SLUG, 'get_isbn'), # Includes. url(r'^b/(?P\d+)/mini\.(?P.+)\.html', 'book_mini', name='catalogue_book_mini'), diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 503b6f533..fd98dee23 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -794,3 +794,8 @@ def ridero_cover(request, slug): response = HttpResponse(content_type="image/png") cover.save(response) return response + + +def get_isbn(request, book_format, slug): + book = Book.objects.get(slug=slug) + return HttpResponse(book.extra_info.get('isbn_%s' % book_format)) -- 2.20.1