Вопрос

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 simple. 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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top