Howto: Dynamically generate CSRF-Token in WTForms with Flask Howto: Dynamically generate CSRF-Token in WTForms with Flask flask flask

Howto: Dynamically generate CSRF-Token in WTForms with Flask


I discovered how it works:

The CSRF-Tag can simply be copied. The id must be changed and incremented accordingly, but the hash may stay the same.

I didn't think it was possible to have many Fields with the same CSRF-Tag hash, but it actually does!