flask-wtforms. QuerySelectField RuntimeError
问题 Im trying to use QuerySelectField in FlaskForm, but getting error. admin/forms.py class ServiceForm(FlaskForm): # def __init__(self, *args, **kwargs): # super(ServiceForm, self).__init__(*args, **kwargs) # self.category.choices = [(cat.id, cat.name) for cat in ServiceCategory.query.all()] category = QuerySelectField('Category', query_factory=ServiceCategory.query, get_pk=lambda a: a.id, get_label=lambda a: a.name) name = StringField('Name', validators=[DataRequired()]) description =