from wtforms import Form, SubmitField, StringField, PasswordField, IntegerField, FileField, validators, FloatField def is_empty(s: str): return s is None or len(s) == 0 class ReplaceForm(Form): # background: 可以是图片文件名称,也可以是r,g,b,w或者是颜色的hex background = StringField(label="background", validators=[]) bg_file_id = StringField("bg_file_id", validators=[]) file_id = StringField(label="file_id", validators=[validators.DataRequired(message="请先上传图片")])