django-react-boilerplate icon indicating copy to clipboard operation
django-react-boilerplate copied to clipboard

Add ensure_csrf_cookie just in case

Open fjsj opened this issue 3 years ago • 0 comments

Add ensure_csrf_cookie just in case.

From Django docs:

If your view is not rendering a template containing the csrf_token template tag, Django might not set the CSRF token cookie. This is common in cases where forms are dynamically added to the page. To address this case, Django provides a view decorator which forces setting of the cookie: ensure_csrf_cookie().

fjsj avatar Dec 02 '21 19:12 fjsj