How to populate my WTForm variables?

前端 未结 1 914
自闭症患者
自闭症患者 2021-02-19 05:09

I\'m enabling a function that can edit an entity. I want to populate the form with the variables from the datastore. How can I do it? My code doesn\'t populate the form:

1条回答
  •  一个人的身影
    2021-02-19 05:22

    You need to pass your object via the form's second argument, "obj":

    editAdForm = AdForm(obj=ad)
    

    Outlined in the documentation crash course here: http://wtforms.simplecodes.com/docs/dev/crash_course.html#editing-existing-objects

    0 讨论(0)
提交回复
热议问题