python - Flask-wtf 字段渲染示例

标签 python html wtforms

我正在将 wtforms 字段 ( http://wtforms.simplecodes.com/docs/0.6/fields.html ) 与 <input> 进行比较标签( http://www.w3schools.com/tags/att_input_type.asp )。对于 wtforms 中的某些字段,<input type>等价物很容易猜到。但对于其他人,我真的不知道如何实现。

是否有任何示例网页可以让我尝试渲染 wtform 字段?或者是否有一些 wtforms 模板集合,以便我可以自己尝试?

最佳答案

只需查看源代码即可轻松找到答案:

# ... snip ...
class SearchField(core.StringField):
    """
    Represents an ``<input type="search">``.
    """
    widget = widgets.SearchInput()


class TelField(core.StringField):
    """
    Represents an ``<input type="tel">``.
    """
    widget = widgets.TelInput()


class URLField(core.StringField):
    """
    Represents an ``<input type="url">``.
    """
    widget = widgets.URLInput()
# ... snip ...

关于python - Flask-wtf 字段渲染示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14567247/

相关文章:

javascript - IE 11 AngularJS 错误 - 对象不支持属性或方法 'from'

python - WTForms 创建自定义小部件

php,var_export 失败并出现 float

python - 每 820 字节保存到新文件

python - 将 dict 的 pandas dataframe 列扩展为 dataframe 列

python - 在python中将十进制转换为三元(base3)

html - 最小宽度滚动条

javascript - 查询 : fadein function not working

python - flask-wtf 使用 wtform 表单构造函数编辑模型 : pre-filling the form

python - 根据 ModelChoiceField 获取 ModelMultipleChoiceField 字段的查询集