如何在 WTForms 中使用 "tel"、"number" 或其他输入类型?

How do I use "tel", "number", or other input types in WTForms?

我想在表单中使用 phone 数字字段。我需要的是在 Android phone 上点击此字段时,不是通用键盘,而是仅出现数字。

我了解到这可以通过使用 <input type="tel"<input type="number" 来实现。

如何在 WTForms 中使用电话或号码输入类型?

这似乎在 WTForms 文档中缺失,但在 HTML 5.

中添加了所有输入类型的字段定义
from wtforms.fields.html5 import TelField

phonenumber = TelField()

在将它们添加到文档之前,here's their definition in the code

好的。我找到了。

IntegerField(小部件=widgets.Input(input_type="tel"))