Last active
June 29, 2018 10:40
-
-
Save cypreess/4313e0824f5ceb990ff34c36a8d358c2 to your computer and use it in GitHub Desktop.
DRF backend allowing to disable csrf force checking on views (https://stackoverflow.com/questions/30871033/django-rest-framework-remove-csrf)
This file contains hidden or 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
| from rest_framework.authentication import SessionAuthentication | |
| class CsrfExemptSessionAuthentication(SessionAuthentication): | |
| def enforce_csrf(self, request): | |
| return # To not perform the csrf check previously happening |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment