pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
BSD 3-Clause "New" or "Revised" License
5.69k stars 1.56k forks source link

WTForms 3.1.0 expanded SelectField choices parameter #2395

Open cjmayo opened 8 months ago

cjmayo commented 8 months ago
  File "/home/runner/work/flask-admin/flask-admin/flask_admin/templates/bootstrap2/admin/lib.html", line 183, in template
    {{ render_field(form, f, kwargs) }}
  File "/home/runner/work/flask-admin/flask-admin/.tox/py/lib/python3.10/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
  File "/home/runner/work/flask-admin/flask-admin/flask_admin/templates/bootstrap2/admin/lib.html", line 137, in template
    {{ field(**kwargs)|safe }}
  File "/home/runner/work/flask-admin/flask-admin/.tox/py/lib/python3.10/site-packages/wtforms/fields/core.py", line 176, in __call__
    return self.meta.render_field(self, kwargs)
  File "/home/runner/work/flask-admin/flask-admin/.tox/py/lib/python3.10/site-packages/wtforms/meta.py", line 64, in render_field
    return field.widget(field, **render_kw)
  File "/home/runner/work/flask-admin/flask-admin/flask_admin/form/widgets.py", line 28, in __call__
    return super(Select2Widget, self).__call__(field, **kwargs)
  File "/home/runner/work/flask-admin/flask-admin/.tox/py/lib/python3.10/site-packages/wtforms/widgets/core.py", line 365, in __call__
    for val, label, selected, render_kw in field.iter_choices():
ValueError: not enough values to unpack (expected 4, got 3)

This is to illustrate the location of the problem for #2391. Clearly it doesn't allow you to use the new option from WTForms 3.1 and I expect it's going to break with WTForms < 3.1.