+_never_cache = cache_control(no_cache=True, must_revalidate=True)
+
+
+def never_cache(view_func):
+ """
+ Decorator that adds headers to a response so that it will
+ never be cached.
+ """
+ @wraps(view_func)
+ def _wrapped_view_func(request, *args, **kwargs):
+ response = view_func(request, *args, **kwargs)
+ patch_cache_control(response, no_cache=True,
+ must_revalidate=True, proxy_revalidate=True)
+ response['Pragma'] = 'no-cache'
+ return response
+ return _wrapped_view_func
+
+
+@sensitive_post_parameters()
+@csrf_protect
+@never_cache