Skip to content
Home » csrf_exempt in Django

csrf_exempt in Django

Let’s start the discussion about csrf_exempt in Django in following Approaches.

The CSRF middleware and template tag offer simple protection against Cross-Site Request Forgeries. This type of attack occurs when a malicious website provides a link, a form button, or some JavaScript designed to perform some action on your website using the credentials of a logged-in user who visits the malicious site in their browser.

csrf_exempt ?

#first you need to import this
from django.views.decorators.csrf import csrf_exempt

#now use @csrf_exempt dacorator as follows

@csrf_exempt
def exampleview(request):
	pass
	#now this view will not require csrf_token to handle post requests

I hope the strategies listed above work for you. Happy coding and come back again.

Similar Post : How to set date timezone in Linux