class ArticleForm(Form):
type = SelectField('type', choices=[(h.id, h.name) for h in ArticleType.query.all()], coerce=int)
below is how I use the ArticleForm in views
@admin.route('/article/add',methods=['get','post'])
def article_create():
article_form = ArticleForm()
my problem is that the selectField is not read the db each time I visit /article/add
If I add a new type in the ArticleType the choice of the selectField will not update the choice until I restart the server.
but If I use like below
@admin.route('/article/add',methods=['get','post'])
def article_create():
article_form = ArticleForm()
article_form.type.choices = [(h.id, h.name) for h in ArticleType.query.all()]
the articleType get updated.. so what's the problem with this...