csrftoken() now works with .render_template(), closes #863

This commit is contained in:
Simon Willison 2020-06-23 20:23:30 -07:00
commit 28bb1c5189
4 changed files with 19 additions and 1 deletions

View file

@ -182,11 +182,17 @@ def register_routes():
else:
return Response.json(await request.post_vars())
async def csrftoken_form(request, datasette):
return Response.html(
await datasette.render_template("csrftoken_form.html", request=request)
)
return [
(r"/one/$", one),
(r"/two/(?P<name>.*)$", two),
(r"/three/$", three),
(r"/post/$", post),
(r"/csrftoken-form/$", csrftoken_form),
]