docs(qrgen): mention problems with default & retained checkbox state

This commit is contained in:
2022-02-14 21:25:35 +01:00
parent 963f0863f7
commit 81294de6d4

View File

@@ -13,7 +13,11 @@ app.config['SECRET_KEY'] = os.urandom(40)
class QRForm(FlaskForm): class QRForm(FlaskForm):
user_data = TextField("Dane:", validators=[DataRequired()]) user_data = TextField("Dane:", validators=[DataRequired()])
trim_spaces = BooleanField("Usuń spacje", default=True) # setting default here doesn't work, so we cannot retain checkbox state over POST
# we force trim_spaced to be checked in the template
# see https://github.com/wtforms/flask-wtf/issues/489 https://github.com/wtforms/flask-wtf/issues/362
# https://github.com/wtforms/flask-wtf/issues/464
trim_spaces = BooleanField("Usuń spacje")
submit = SubmitField("Generuj") submit = SubmitField("Generuj")
@app.route("/", methods=["GET", "POST"]) @app.route("/", methods=["GET", "POST"])