From 6598d9f7378ef6b19a1470c3c2107c06cfbb64e3 Mon Sep 17 00:00:00 2001 From: Scott Bragg Date: Fri, 15 Jul 2016 12:18:36 +1000 Subject: [PATCH] Middleware to add never_cache headers to everything (#51) --- pinaxcon/disable_cscache.py | 7 +++++++ pinaxcon/settings.py | 1 + 2 files changed, 8 insertions(+) create mode 100644 pinaxcon/disable_cscache.py diff --git a/pinaxcon/disable_cscache.py b/pinaxcon/disable_cscache.py new file mode 100644 index 00000000..2a496433 --- /dev/null +++ b/pinaxcon/disable_cscache.py @@ -0,0 +1,7 @@ +from django.utils.cache import add_never_cache_headers + +class DisableClientSideCachingMiddleware(object): + def process_response(self, request, response): + add_never_cache_headers(response) + return response + diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index e0493710..3c391f91 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -115,6 +115,7 @@ MIDDLEWARE_CLASSES = [ 'wagtail.wagtailcore.middleware.SiteMiddleware', 'wagtail.wagtailredirects.middleware.RedirectMiddleware', 'pinaxcon.monkey_patch.MonkeyPatchMiddleware', + 'pinaxcon.disable_cscache.DisableClientSideCachingMiddleware', ] ROOT_URLCONF = "pinaxcon.urls"