+
+
+def download_zip(request, format, slug):
+ url = None
+ if format == 'pdf':
+ url = models.Book.zip_pdf()
+ elif format == 'epub':
+ url = models.Book.zip_epub()
+ elif format == 'mobi':
+ url = models.Book.zip_mobi()
+ elif format == 'audiobook' and slug is not None:
+ book = models.Book.objects.get(slug=slug)
+ url = book.zip_audiobooks()
+ else:
+ raise Http404('No format specified for zip package')
+ return HttpResponseRedirect(urlquote_plus(settings.MEDIA_URL + url, safe='/?='))