add X-Requested-With Vary header to sidebar views
@@ -2,6 +2,7 @@ from functools import wraps
from django.http import HttpResponseNotModified, HttpResponseRedirect
from django.shortcuts import render
+from django.utils.cache import patch_vary_headers
from c3nav.editor.models import ChangeSet
from c3nav.mapdata.models.access import AccessPermission
@@ -29,11 +30,13 @@ def sidebar_view(func=None, select_related=None):
if not isinstance(response, HttpResponseNotModified):
response.write(render(request, 'editor/fragment_nav.html', {}).content)
response['Cache-Control'] = 'no-cache'
+ patch_vary_headers(response, 'X-Requested-With')
return response
if isinstance(response, HttpResponseRedirect):
return response
response = render(request, 'editor/map.html', {'content': response.content})
response['Cache-Control'] = 'no-cache'
+ patch_vary_headers(response, 'X-Requested-With')
return response
return with_ajax_check
