From b9f17bbc33fd80befd314c9c4dce3800c3d8148c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 4 Oct 2018 21:59:28 +0200 Subject: Allow to disable CSRF check for testing purpose --- ishtar_common/middleware.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 ishtar_common/middleware.py (limited to 'ishtar_common') diff --git a/ishtar_common/middleware.py b/ishtar_common/middleware.py new file mode 100644 index 000000000..0c7dea825 --- /dev/null +++ b/ishtar_common/middleware.py @@ -0,0 +1,8 @@ +from django.utils.deprecation import MiddlewareMixin + + +class DisableCsrfCheck(MiddlewareMixin): + def process_request(self, req): + attr = '_dont_enforce_csrf_checks' + if not getattr(req, attr, False): + setattr(req, attr, True) -- cgit v1.2.3