add X-Requested-With Vary header to sidebar views

This commit is contained in:
Laura Klünder 2017-10-27 17:23:58 +02:00
parent 6e9d2424f8
commit 9dafd3f777

View file

@ -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