MrBetterman
V2EX  ›  Flask

请教一下 SelectField 这种字段

  •  
  •   MrBetterman ·
    mr-betterman · Mar 6, 2017 · 4124 views
    This topic created in 3530 days ago, the information mentioned may be changed or developed.
    我的定义是这样的,没有另外键另一个表,能不能在模板上取到我选择的值
    user_type = SelectField(u'用户类型', validators=[Required()] ,choices=[('0', u'房客'),('1', u'房东')])
    1 replies  •  2017-03-06 23:20:32 +08:00
    codeframe
    codeframe
    Mar 6, 2017
    1
    在模板里直接用 form.user_type() 会自动帮你生成对应的选择列表
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1390 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:51 · PVG 02:51 · LAX 10:51 · JFK 13:51
    ♥ Do have faith in what you're doing.