Missing requirement in requirements-test.txt
[redakcja.git] / apps / catalogue / views.py
index a397830..1436fc0 100644 (file)
@@ -477,8 +477,17 @@ 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 [
+            (_('books'), reverse('catalogue_document_list')),
+            (self.object.title, self.object.get_absolute_url()),
+            (_('scan gallery'),),
+        ]
 
     def get_directory(self):
         return "%s%s/" % (settings.IMAGE_DIR, self.object.gallery)
-