From: Jan Szejko Date: Thu, 29 Jun 2017 09:52:26 +0000 (+0200) Subject: isbn getter X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/fb08d6c6a6dca486303ca69b5c47dd29e548fd11?ds=inline isbn getter --- 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))