Python - render with csrf protection

后端 未结 3 1021
醉话见心
醉话见心 2021-01-13 18:42

I\'ve read several posts about csrf protection in Django, including Django\'s documentation , but I\'m still quite confused in how to use it correctly.

The clearest

3条回答
  •  -上瘾入骨i
    2021-01-13 19:28

    The point of using the render shortcut is that it then runs all the context processors automatically. Context processors are useful little functions that add various things to the template context every time a template is rendered. And there is a built-in context processor that already adds the CSRF token for you. So, if you use render, there is nothing more to do other than to output the token in the template.

提交回复
热议问题