gpt4 book ai didi

python - WTForms - 将文本字段发布到数组

转载 作者:太空宇宙 更新时间:2023-11-03 13:40:46 24 4
gpt4 key购买 nike

在常规 HTML 中,您可以将多个字段 POST 到一个数组:

<input type="text" name="arr[]">
<input type="text" name="arr[]">
<input type="text" name="arr[]">
<input type="text" name="arr[]">

如何从 WTForms 获得此功能?基本上,我有一个表单,用户可以在其中单击小的加号和减号按钮来添加或删除表单中的字段。

最佳答案

您正在寻找 WTForm FieldList .它允许您创建同一字段的任意列表。

例如

emails = FieldList(StringField('email'), min_entries=1, max_entries=5)

关于python - WTForms - 将文本字段发布到数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31712220/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com