Created
October 4, 2012 18:24
-
-
Save 235/3835439 to your computer and use it in GitHub Desktop.
Django: Disables CSRF for the whole project to simplify prototyping, unsecure in production
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Disables CSRF for the whole project to simplify prototyping, unsecure in production """ | |
class DisableCSRF(object): | |
#def process_view(self, request, callback, callback_args, callback_kwargs): | |
def process_request(self, request): | |
setattr(request, '_dont_enforce_csrf_checks', True) | |
### === Add to settings.py: | |
#============================================================================== | |
# Middleware | |
#============================================================================== | |
MIDDLEWARE_CLASSES += ( | |
'app.apps.disable_csrf.DisableCSRF', | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment