- Pass the AJAX referer for all AJAX requests.

- Switch to synchronous requests.
- All location changes go through the setLocation method.
- Switch to using history.pushState.
- AJAX middleware inserts AJAX referer as the request HTTP_REFERER.

Signed-off-by: Eric Riggs <ericriggs42@gmail.com>
This commit is contained in:
Eric Riggs
2018-04-01 19:54:50 -04:00
committed by Roberto Rosario
parent f3f4dcd84a
commit 3be28131c9
2 changed files with 36 additions and 21 deletions
@@ -5,6 +5,14 @@ from django.http import HttpResponseRedirect
class AjaxRedirect(object):
def process_request(self, request):
ajax_referer = request.META.get('HTTP_X_ALT_REFERER')
if ajax_referer:
request.META['HTTP_REFERER'] = ajax_referer
return None
def process_response(self, request, response):
if request.is_ajax():
if type(response) == HttpResponseRedirect: