Skip to content Skip to sidebar Skip to footer

Jinja, Flask And Wtforms: How To Pass Parameters In Field?

I am following this tutorial http://flask.pocoo.org/docs/0.10/patterns/wtforms/ Here’s an example _formhelpers.html template with a macro: {% macro render_field(field) %}

Solution 1:

Coming from the documentation you can do:

{{ form.email(class_="input-xlarge", 
              placeholder="Email Address",
              value="testemail@testing.com") }}

Which will render:

<inputtype="email"id="email"name="email"class="input-xlarge"placeholder="Email Address"value="testemail@testing.com"required>

Just replace "testemail@testing.com" with form.email without braces as you are already inside them.

Post a Comment for "Jinja, Flask And Wtforms: How To Pass Parameters In Field?"