X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/d90edc4826d6c3d3a40f52fa5c88cf4b1741ab63..b07520a11332374de645ed22c74959afa8a4b7ed:/apps/ajaxable/utils.py?ds=inline diff --git a/apps/ajaxable/utils.py b/apps/ajaxable/utils.py index 14b5dfc7a..a6faafa05 100755 --- a/apps/ajaxable/utils.py +++ b/apps/ajaxable/utils.py @@ -35,9 +35,8 @@ class AjaxableFormView(object): form_class = None # override to customize form look template = "ajaxable/form.html" - # set to redirect after succesful ajax-less post submit = _('Send') - redirect = None + title = '' success_message = '' formname = "form" @@ -51,10 +50,11 @@ class AjaxableFormView(object): if form.is_valid(): self.success(form, request) redirect = request.GET.get('next') - if not ajax and redirect is not None: + if not ajax and redirect: return HttpResponseRedirect(urlquote_plus( - redirect, safe='/?=')) - response_data = {'success': True, 'message': self.success_message} + redirect, safe='/?=')) + response_data = {'success': True, + 'message': self.success_message, 'redirect': redirect} else: response_data = {'success': False, 'errors': form.errors} if ajax: