Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WTForms Version 3.1.0 introduced a breaking change for Flask-Admin forms #2582

Closed
chrisdellisantirn opened this issue Dec 20, 2024 · 1 comment

Comments

@chrisdellisantirn
Copy link

chrisdellisantirn commented Dec 20, 2024

It seems that WTForms now returns four elements in iter_choices() tuples instead of the two or three that Flask-Admin expects. As a result, whenever I try to render a form that uses a SelectField or a similar field that relies on iter_choices(), I get:

ValueError: not enough values to unpack (expected 4, got 3)

Downgrading WTForms to 3.0.0 resolved the issue. I checked out their change logs and they show:

⚠️breaking change⚠️: iter_choices now returns a tuple of 4 items

Environment:

  • Python version: 3.10
  • Flask version: 3.1.0
  • Flask-Admin version: 1.6.1
@samuelhwilliams
Copy link
Contributor

This is fixed in the (currently alpha) versions of Flask v2.0.0a0 onwards. We're loosely planning to do a full v2 release once mongoengine support (#2541) and azure-blob-storage (#2566) updates have been merged.

You may wish to try those alpha releases for now, based on your use-case, though. I will close this as the only thing outstanding is an official v2 release - there are no further specific code changes needed for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants