[PATCH v2 1/5] static: add JS Cookie Library to get csrftoken for fetch requests

Jonathan Nieder jrnieder at gmail.com
Tue Jul 27 09:53:03 AEST 2021


Hi,

Raxel Gutierrez wrote:

> Currently, requests are made only through form submission and the
> csrftoken is added to templates using {% csrf_token %}. Following Django
> docs [1], the library is useful to add csrftoken when making requests in
> JavaScript.
>
> [1] https://docs.djangoproject.com/en/3.2/ref/csrf/#ajax
>
> Signed-off-by: Raxel Gutierrez <raxel at google.com>
> ---
>  htdocs/README.rst          | 9 +++++++++
>  htdocs/js/js.cookie.min.js | 3 +++
>  templates/base.html        | 1 +
>  3 files changed, 13 insertions(+)
>  create mode 100644 htdocs/js/js.cookie.min.js

Just moments ago, 3.0.0 came out, which is importable as a js module.
Worth trying?

With or without that change,
Reviewed-by: Jonathan Nieder <jrnieder at gmail.com>

Thanks.


More information about the Patchwork mailing list