@csrf code example
Example 1: 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
Example 2: csrf token method
<meta name="csrf-token" content="{{ csrf_token() }}">