You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just in case anyone is having trouble with form submission and csrf tokens without using ajax, this is the solution I used to solve it:
Step 1: Create a middleware class which shares data to views on all requests
class CsrfTokenMiddleware:
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
def __call__(self, request):
# Code to be executed for each request before
# the view (and later middleware) are called.
share(request, csrf=get_token(request))
response = self.get_response(request)
# Code to be executed for each request/response after
# the view is called.
return response
Hey everyone
Just in case anyone is having trouble with form submission and csrf tokens without using ajax, this is the solution I used to solve it:
Step 1: Create a middleware class which shares data to views on all requests
Step 2: Add it to the middleware settings
Step 3: accept it as a prop in your *.vue files
Step 4: Add a hidden field to your form
This was the only solution that worked for me. I tried both solution provided in the README without success.
The text was updated successfully, but these errors were encountered: