Делаю так:
... sql = 'SELECT * FROM dirFilial' fres = db.engine.execute(sql) names = [(frow[0],frow[1]) for frow in fres] filial=SelectField('Филиал',choises=names) ...
Выдает ошибку:
Traceback (most recent call last): File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 2328, in __call__ return self.wsgi_app(environ, start_response) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 2314, in wsgi_app response = self.handle_exception(e) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 1760, in handle_exception reraise(exc_type, exc_value, tb) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/_compat.py", line 36, in reraise raise value File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 2311, in wsgi_app response = self.full_dispatch_request() File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 1834, in full_dispatch_request rv = self.handle_user_exception(e) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 1737, in handle_user_exception reraise(exc_type, exc_value, tb) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/_compat.py", line 36, in reraise raise value File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 1832, in full_dispatch_request rv = self.dispatch_request() File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask/app.py", line 1818, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/srv/www/htdocs/rac/index.py", line 32, in index form=LoginForm() File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/wtforms/form.py", line 212, in __call__ return type.__call__(cls, *args, **kwargs) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask_wtf/form.py", line 158, in __init__ super(Form, self).__init__(*args, **kwargs) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/flask_wtf/form.py", line 88, in __init__ super(FlaskForm, self).__init__(formdata=formdata, **kwargs) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/wtforms/form.py", line 272, in __init__ super(Form, self).__init__(self._unbound_fields, meta=meta_obj, prefix=prefix) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/wtforms/form.py", line 52, in __init__ field = meta.bind_field(self, unbound_field, options) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/wtforms/meta.py", line 27, in bind_field return unbound_field.bind(form=form, **options) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/wtforms/fields/core.py", line 353, in bind return self.field_class(*self.args, **kw) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/wtforms/fields/core.py", line 449, in __init__ super(SelectField, self).__init__(label, validators, **kwargs) File "/srv/www/htdocs/rac/venv/lib/python3.6/site-packages/wtforms/fields/core.py", line 418, in __init__ super(SelectFieldBase, self).__init__(label, validators, **kwargs) TypeError: __init__() got an unexpected keyword argument 'choises'