How does one omit the closing slash on <input> elements using WTForms?
I've been noticing that WTForms (and Flask-WTF) output <input>
elements with a closing slash like so:
<input name="text" type="text" value="" />
My documents are HTML5 and therefore need no XHTML-type closure. How would I make WTForms output the input tag as such?
<input name="text" type="text" value="">
I've been tearing through the docs and the source code an am finding no clues. I could create a series of custom widgets, of course, but that seems a bit excessive for something so si开发者_如何学运维mple. Is there an easier way?
Or is this perhaps a Jinja2 configuration issue that I'm missing?
Use any revision past this one (or simply download tip) - WTForms is moving to the HTML5 way of generating form elements and adding some new widgets too (I believe). See this thread and this one for a bit more information.
* There is also an extension for WTForms that adds the XHTML back in, if you decide you need it.
精彩评论