This [example] [1] to create a form with WTForms and SQLAlchemy in Flask and add a QuerySelectField to the form. I do not use flask.ext.sqlalchemymy code:
ContentForm = model_form(Content, base_class=Form)
ContentForm.author = QuerySelectField('Author', get_label="name")
myform = ContentForm(request.form, content)
myform.author.query = query_get_all(Authors)
Now I want to set the default value for the QuerySelectField selection list .
Tried to skip defaultkwarg in QuerySelectField and set attributes selected. Nothing succeeded. Am I missing something? Can anyone help?
source
share