[Flask] Flask / Wtforms Jinja

Ben Duncan linux4ms at gmail.com
Thu Sep 19 11:11:05 EDT 2019


In using wtforms and rendering with jinja
is there a way  to test in the template for a render_kw dictionary item?
example:

class ContactForm(FlaskForm):
      name = StringField("Name: "
             ,render_kw={ 'style': 'width: 350px; size:30', 'required': ''})
      email = StringField("Email: ", validators=[Email()])

I would like to do something like this in the *template*:
{% if form.name.render_kw("required") %}
   THIS FIELD IS REQUIRED
{% endif %}

As usually thanks ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20190919/99ede2db/attachment.html>


More information about the Flask mailing list