Skip to content

Instantly share code, notes, and snippets.

@235
Created October 4, 2012 18:24
Show Gist options
  • Save 235/3835439 to your computer and use it in GitHub Desktop.
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
""" 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