X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/a1d59523f422c3674a39b0d65ea2c97acca7ede8..0946041483bdb729ae076d8ead0699524eeeb4b2:/apps/catalogue/views.py?ds=sidebyside diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index ebc35751..9bd69f8b 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -26,7 +26,7 @@ from catalogue import forms from catalogue import helpers from catalogue.helpers import active_tab from catalogue.models import Book, Chunk, BookPublishRecord, ChunkPublishRecord, Project -from fileupload.views import UploadView +from fileupload.views import UploadView, PackageView # # Quick hack around caching problems, TODO: use ETags @@ -488,13 +488,17 @@ def publish(request, slug): return http.HttpResponseRedirect(book.get_absolute_url()) -class GalleryView(UploadView): +class GalleryMixin(object): + def get_directory(self): + return "%s%s/" % (settings.IMAGE_DIR, self.object.gallery) def get_object(self, request, slug): book = get_object_or_404(Book, slug=slug) if not book.gallery: raise Http404 return book +class GalleryView(GalleryMixin, UploadView): + def breadcrumbs(self): return [ (_('books'), reverse('catalogue_document_list')), @@ -502,5 +506,8 @@ class GalleryView(UploadView): (_('scan gallery'),), ] - def get_directory(self): - return "%s%s/" % (settings.IMAGE_DIR, self.object.gallery) + +class GalleryPackageView(GalleryMixin, PackageView): + + def get_redirect_url(self, slug): + return reverse('catalogue_book_gallery', kwargs = dict(slug=slug))