From: Marcin Koziej Date: Fri, 30 Dec 2011 12:43:13 +0000 (+0100) Subject: custom pdf download via ajaxable X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/0a693dbc08fd1c2c95538f627985fc03f9e3b684?ds=sidebyside;hp=--cc custom pdf download via ajaxable --- 0a693dbc08fd1c2c95538f627985fc03f9e3b684 diff --git a/apps/ajaxable/utils.py b/apps/ajaxable/utils.py index a6faafa05..d6f70501d 100755 --- a/apps/ajaxable/utils.py +++ b/apps/ajaxable/utils.py @@ -52,7 +52,7 @@ class AjaxableFormView(object): redirect = request.GET.get('next') if not ajax and redirect: return HttpResponseRedirect(urlquote_plus( - redirect, safe='/?=')) + redirect, safe='/?=&')) response_data = {'success': True, 'message': self.success_message, 'redirect': redirect} else: diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index b874c4c0a..34c9c1f1f 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -730,7 +730,13 @@ class CustomPDFFormView(AjaxableFormView): submit = _('Download') def __call__(self, request): + from copy import copy if request.method == 'POST': - return download_custom_pdf(request, request.GET['book_id'], method='POST') - else: - return super(CustomPDFFormView, self).__call__(request) + request.GET = copy(request.GET) + request.GET['next'] = "%s?%s" % (reverse('catalogue.views.download_custom_pdf', args=[request.GET['slug']]), + request.POST.urlencode()) + return super(CustomPDFFormView, self).__call__(request) + + + def success(self, *args): + pass diff --git a/wolnelektury/templates/catalogue/book_wide.html b/wolnelektury/templates/catalogue/book_wide.html index 59abe0f0f..0506c8ec8 100644 --- a/wolnelektury/templates/catalogue/book_wide.html +++ b/wolnelektury/templates/catalogue/book_wide.html @@ -38,7 +38,7 @@ {% endif %}
  • - {% trans "Download a custom PDF" %} + {% trans "Download a custom PDF" %}