Issue
What is @csrf_exempt
, and why should we use this in our views.py
? Also, are there any alternatives to it?
Solution
Normally when you make a request via a form you want the form being submitted to your view to originate from your website and not come from some other domain. To ensure that this happens, you can put a csrf token in your form for your view to recognize. If you add @csrf_exempt
to the top of your view, then you are basically telling the view that it doesn't need the token. This is a security exemption that you should take seriously.
Answered By - Matt Cremeens
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.