coolair
V2EX  ›  问与答

Flask FieldList 中的多个 SelectField 如何读取并显示数据中选中的项?

  •  
  •   coolair · Dec 1, 2016 · 2604 views
    This topic created in 3475 days ago, the information mentioned may be changed or developed.
    class MyFieldListForm(Form):
    ....selectlist= FieldList(FormField(MyForm), min_entries=1)
    ....submit = SubmitField('Submit')

    form = MyFieldListForm(obj=sths)
    for item in form.selectlist:
    ....item.item_select.data = DATA_FROM_DATABASE

    我这样设置后,刷新页面还是不显示数据库中存的项,而是全部显示第一项,为什么?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   847 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:13 · PVG 04:13 · LAX 13:13 · JFK 16:13
    ♥ Do have faith in what you're doing.