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
})
+@login_required
def chunk_edit(request, slug, chunk):
try:
doc = Chunk.get(slug, chunk)
@transaction.commit_on_success
+@login_required
def chunk_mass_edit(request):
if request.method == 'POST':
ids = map(int, filter(lambda i: i.strip()!='', request.POST.get('ids').split(',')))
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')),
(_('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))