MrBetterman
V2EX  ›  Flask

请教一下 SelectField 这种字段

  •  
  •   MrBetterman ·
    mr-betterman · Mar 6, 2017 · 3732 views
    This topic created in 3386 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
        1
    codeframe  
       Mar 6, 2017
    在模板里直接用 form.user_type() 会自动帮你生成对应的选择列表
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   901 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:45 · PVG 05:45 · LAX 14:45 · JFK 17:45
    ♥ Do have faith in what you're doing.