Home > Back-end >  WTForms how to replace {{}} inside {{}}
WTForms how to replace {{}} inside {{}}

Time:09-27

I m pretty sure by title, this is unclear to you. Here is my code

{{wtf.quick_form(form, action='/edit?id={{id}}', method='POST')}}

Now I want to replace {{id}} with id that'll be passed to html page by flask but now, it is not replace {{id}} with the actual id(1) So how can I fix this? I use WtForms, python, Flask, Flaskform

CodePudding user response:

You can concatenate the static part with the dynamic part.

Use

{{wtf.quick_form(form, action='/edit?id=' ~ id, method='POST')}}

or

{{wtf.quick_form(form, action='/edit?id=%s' % id, method='POST')}}
  • Related