From 72afcd696d097e09c792c395b8e2149820fefe2c Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 8 Mar 2013 10:25:04 +0100 Subject: [PATCH] Check if book gallery set. --- apps/catalogue/templates/catalogue/book_detail.html | 2 ++ apps/catalogue/views.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/catalogue/templates/catalogue/book_detail.html b/apps/catalogue/templates/catalogue/book_detail.html index 7f339bc1..eea6a6c7 100755 --- a/apps/catalogue/templates/catalogue/book_detail.html +++ b/apps/catalogue/templates/catalogue/book_detail.html @@ -17,7 +17,9 @@ {% if editable %}{% endif %} {% if editable %} + {% if book.gallery %}

{% trans "Edit gallery" %}

+ {% endif %}

{% trans "Append to other book" %}

{% endif %} diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index e09940d6..1436fc02 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -477,7 +477,10 @@ def publish(request, slug): class GalleryView(UploadView): def get_object(self, request, slug): - return get_object_or_404(Book, slug=slug) + book = get_object_or_404(Book, slug=slug) + if not book.gallery: + raise Http404 + return book def breadcrumbs(self): return [ -- 2.20.1