Answers for "csrf token validation in django"

3

csrf token exempt django

from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def xyx(request):
  #your code
  
#this makes the function accept post request without csrf token
#use it just for quick check or for operations where csrftoken authentication
#isn't required
Posted by: Guest on July-18-2021
1

get csrf_token value in django template

# get csrf token value in template
{{ csrf_token }}
# render a input form element 
{% csrf_token %}
Posted by: Guest on June-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language