Here is a function you can run that can replace "render" so that it includes the response headers assignments without needing to repeat the value assignments to the different response headers. This is probably useful if you don't want to repeat your code and you want to apply the changes to some, but not all views. Below is specifically a function that makes sure the rendering doesn't cache:
def render_cacheless(action, path, context):
response = render(action, path, context)
response["Cache-Control"] = "no-cache, no-store, must-revalidate"
response["Pragma"] = "no-cache"
response["Expires"] = "0"
return response
def home(request):
return render_cacheless(request, "/path/to/home.html", None)