How can I embed django csrf token straight into HTML? -


Inside my demo app, I am storing html strings in DB, which is the "message" . Some of these messages contain the form, but the template is not written in the language, I am not able to CSRF token (thus not able to break the app).

Am I editing a way to insert this token directly from Python files? I'm looking for something from:

  csrf_token = django.csrf.generate () message = "please press the button: 

Any other solution that will work in the same scenario will be great thanks

edit: This will not actually work because the tokens are available for each session Is different for this, so it is in DB Storage is not very helpful to have a way to dynamically load the tokens in what sequence?

call django.middleware to get CSRF token csrf.get_token (request) .


Comments