wtforms, CSRF, flask, FieldList

前端 未结 4 1420
陌清茗
陌清茗 2020-12-10 12:14

I\'m having trouble passing through validation when using a FieldList with WTForms. I keep getting this error. {\'csrf_token\': [u\'CSRF token missing\'

4条回答
  •  星月不相逢
    2020-12-10 12:18

    Since version 1.0 the new way to achieve this is as follows: This will disable the CSRF token for all instances of your Form, so be careful to only use it as a subform.

    class MyForm(FlaskForm):
        class Meta:
            csrf = False
    
        myfield = StringField("A Field")
    

提交回复
热议问题