I want to pass a str to be used as the prompt for a form. I thought it would be simple but it is proving to be difficult.
Here is my code:
class PostForm(FlaskForm):
post = TextAreaField(Question, validators=[DataRequired()])
submit = SubmitField('Submit')`
And,
form = PostForm('my question')
the corresponding html
{{ wtf.quick_form(form) }}
So, I still don't have an answer to the question, but I did manage to come up with a solution.
And then in the routes
The explanation for this is that TextAreaField creates a label attribute on post that is accessible and changable, but it needs to be formated correctly as a Label object from wtforms.fields.core. (Simply reassigning it as a string did not work). The representation of this object is:
And it is of type