coolair
V2EX  ›  问与答

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

  •  
  •   coolair · Dec 1, 2016 · 2611 views
    This topic created in 3481 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   ·   3007 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 06:54 · PVG 14:54 · LAX 23:54 · JFK 02:54
    ♥ Do have faith in what you're doing.