我有一些字符串字段,我想防止出现任何空格。在Flask-wtforms中如何做到这一点?
class RegistrationForm(FlaskForm):
first_name = StringField('First name',validators=[DataRequired(),Length(min=2,max=64)])
last_name = StringField('Last name',validators=[DataRequired(),Length(min=2,max=64)])发布于 2020-01-28 06:55:03
尝试Regexp:
validators.Regexp('^\w+$', message="Username must contain only letters numbers or underscore"),http://wtforms.simplecodes.com/docs/0.6.1/validators.html#wtforms.validators.Regexp
https://stackoverflow.com/questions/59939988
复制相似问题