Python 烧瓶表单。提交时未更新数据值

Python 烧瓶表单。提交时未更新数据值,python,flask,flask-wtforms,wtforms,flask-restful,Python,Flask,Flask Wtforms,Wtforms,Flask Restful,我有一个表单,可以使用.default方法动态填充的值 像这样: for i, item in enumerate(staff): if item.id == "csrf_token" or item.id == "submitstaff": continue item.default = stafftable[0][i] staff.process() 我也使用了这个表单,没有这个过程,它是有效的。但是,当我在完成这个过程后使用它时,它总是采用默认值,

我有一个表单,可以使用.default方法动态填充的值

像这样:

for i, item in enumerate(staff):
    if item.id == "csrf_token" or item.id == "submitstaff":
        continue
    item.default = stafftable[0][i]
    staff.process()
我也使用了这个表单,没有这个过程,它是有效的。但是,当我在完成这个过程后使用它时,它总是采用默认值,不允许用户再更新这些值。例如,如果我再次显示表单并尝试更改字段的值,它将采用流程设置的.default字段,而不是输入

表格:


所以经过一些研究,我发现使用.process导致它无法正常工作。但是,如果上面的代码没有使用.process,它将不会在网页上显示数据

显示数据的解决方案实际上是使用.data而不是.default

class Staff(FlaskForm):
    staffid = StringField(
        validators=[DataRequired(message="Staff Id Field can not be left blank")]
    )
    Firstname = StringField(
        validators=[DataRequired(message="Firstname Field can not be left blank")]
    )
    LastName = StringField(
        validators=[DataRequired(message="LastName Field can not be left blank")]
    )
    ProjectRole = StringField(
        validators=[DataRequired(message="ProjectRole Field can not be left blank")]
    )
    YearsOfExperience = FloatField(
        validators=[
            DataRequired(message="Years of experience Field can not be left blank")
        ]
    )
    Organisation = SelectField(
        "Organisations",
        choices=[
            ("1","1"),
            ("1","1"),
            ("1","1"),
        ],
    )
    OfficeLocation = StringField(
        validators=[DataRequired(message="Office location Field can not be left blank")]
    )
    Discipline = SelectField(
        "Discipline",
        choices=[
            ("Geotechnics", "Geotechnics"),
            ("Civil", "Civl"),
            ("Digital", "Digital"),
            ("Project Management", "Project Management"),
        ],
    )
    KeyPersonName = SelectField(choices=[("No","No"),("Yes","Yes")])
    BatchNo = StringField(
        validators=[DataRequired(message="BatchNo Field can not be left blank")]
    )
    ProjectStatus = StringField(
        validators=[DataRequired(message="ProjectStatus Field can not be left blank")]
    )
    Booking = StringField(
        validators=[DataRequired(message="Booking Field can not be left blank")]
    )
    TasksEarlyDeliverables = TextAreaField(
        validators=[
            DataRequired(
                message="Tasks and early deliverables Field can not be left blank"
            )
        ]
    )

    requester = StringField()
    package = StringField()
    PercentoftimeS1 =  FloatField()
    HourlyRate = FloatField()
    PercentoftimeS2 = FloatField()

    submitstaff = SubmitField(label="Submit", validators=[DataRequired()])