From 24a30f976686c4d183c1bd09cdae95c15a7b8dae Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 14 Feb 2011 15:45:47 +0100 Subject: [PATCH 1/1] daisy & lesmianator fix --- apps/catalogue/models.py | 5 ++++- apps/lesmianator/views.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index b78b5939b..00baa287e 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -160,7 +160,10 @@ def book_upload_path(ext=None, maxlen=100): def get_dynamic_path(media, filename, ext=ext): # how to put related book's slug here? if not ext: - ext = media.type + if media.type == 'daisy': + ext = 'daisy.zip' + else: + ext = media.type if not media.name: name = slughifi(filename.split(".")[0]) else: diff --git a/apps/lesmianator/views.py b/apps/lesmianator/views.py index bb0a562fc..56acb5763 100644 --- a/apps/lesmianator/views.py +++ b/apps/lesmianator/views.py @@ -66,8 +66,11 @@ def poem_from_set(request, shelf): def get_poem(request, poem): p = get_object_or_404(Poem, slug=poem) p.visit() - books = Book.objects.filter(id__in=p.get_created_from_value()) - book = books[0] if len(books) == 1 else None + if p.created_from: + books = Book.objects.filter(id__in=p.get_created_from_value()) + book = books[0] if len(books) == 1 else None + else: + books = book = None return render_to_response('lesmianator/poem.html', {"poem": p, "books": books, "book": book}, -- 2.20.1