You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hit an issue with a couple of my Flask-Admin applications, and can recreate in the attached example.
The issue is that when clicking "Create" or "Edit" Flask-Admin errors with the below traceback:
[2024-10-22 10:11:46 +0100] [73] [ERROR] Error handling request /admin/definitions/new/?url=/admin/definitions/
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/gunicorn/workers/gthread.py", line 282, in handle
keepalive = self.handle_request(req, conn)
File "/usr/local/lib/python3.10/dist-packages/gunicorn/workers/gthread.py", line 334, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2552, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2532, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/usr/local/lib/python3.10/dist-packages/flask_admin/base.py", line 69, in inner
return self._run_view(f, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/flask_admin/base.py", line 369, in _run_view
return fn(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/flask_admin/model/base.py", line 2093, in create_view
form = self.create_form()
File "/usr/local/lib/python3.10/dist-packages/flask_admin/model/base.py", line 1332, in create_form
return self._create_form_class(get_form_data(), obj=obj)
File "/usr/local/lib/python3.10/dist-packages/wtforms/form.py", line 209, in __call__
return type.__call__(cls, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/flask_admin/form/__init__.py", line 22, in __init__
super(BaseForm, self).__init__(formdata=formdata, obj=obj, prefix=prefix, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/wtforms/form.py", line 281, in __init__
super().__init__(self._unbound_fields, meta=meta_obj, prefix=prefix)
File "/usr/local/lib/python3.10/dist-packages/wtforms/form.py", line 49, in __init__
field = meta.bind_field(self, unbound_field, options)
File "/usr/local/lib/python3.10/dist-packages/wtforms/meta.py", line 28, in bind_field
return unbound_field.bind(form=form, **options)
File "/usr/local/lib/python3.10/dist-packages/wtforms/fields/core.py", line 387, in bind
return self.field_class(*self.args, **kw)
File "/usr/local/lib/python3.10/dist-packages/wtforms/fields/core.py", line 133, in __init__
for k, v in flags.items():
AttributeError: 'tuple' object has no attribute 'items'
For the record @macmule, flask-admin uses tuple flags, but they have been deprecated 4 years ago in favor of dict flags (with #467) and the deprecated code have been removed with 3.2 (with #859).
I hit an issue with a couple of my Flask-Admin applications, and can recreate in the attached example.
The issue is that when clicking "Create" or "Edit" Flask-Admin errors with the below traceback:
To recreate:
The resolution:
Pinning WTForms to 3.1.2 resolved the issue, (3.2.0 errored with
ImportError: cannot import name 'SelectFieldBase' from 'wtforms.fields'
).The text was updated successfully, but these errors were encountered: