def process_response(self, request, response): if request.is_ajax(): if isinstance(response, HttpResponseRedirect) or \ isinstance(response, HttpResponsePermanentRedirect): return HttpResponseAjax( [commands.redirect(response['Location'])]) return response
def process_response(self, request, response): if request.is_ajax(): if isinstance(response, HttpResponseRedirect) or \ isinstance(response, HttpResponsePermanentRedirect): return HttpResponseAjax([ commands.redirect(response['Location'])]) return response
def callback(cls, request, result, context): if result['deployment_id']: deployment = models.Deployment.objects.get( pk=result['deployment_id']) messages.success( request, _('The VCL has been safely deployed to group %s') % ( deployment.group_name)) return [ commands.redirect( reverse( 'vcl:deployment', kwargs={ 'deployment_id': deployment.id, } ) ), ] else: messages.error(request, result['error']) return [commands.redirect(reverse('vcl:deploy'))]
def _redirect(self, request, secure): protocol = secure and 'https' or 'http' url = '%s://%s%s' % (protocol, request.get_host(), request.get_full_path()) if settings.DEBUG and request.method == 'POST': raise RuntimeError( '''Django can't perform a redirect while maintaining POST data. Please structure your views so that redirects only occur during GETs.''') if request.is_ajax(): return HttpResponseAjax([commands.redirect(url)]) else: return HttpResponseRedirect(url)
def _redirect(self, request, secure): protocol = secure and 'https' or 'http' url = '%s://%s%s' % ( protocol, request.get_host(), request.get_full_path()) if settings.DEBUG and request.method == 'POST': raise RuntimeError( '''Django can't perform a redirect while maintaining POST data. Please structure your views so that redirects only occur during GETs.''') if request.is_ajax(): return HttpResponseAjax([commands.redirect(url)]) else: return HttpResponseRedirect(url)