-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
SelectField
choice refactoring
#739
Conversation
2c7d45f
to
3a1d060
Compare
This would be very useful 👍 |
3a1d060
to
27515f4
Compare
@davidism does this sound safe to you? |
27515f4
to
99c0a64
Compare
Seems good to me. Instead of passing longer tuples, you might want to consider a |
Do you mean we should break the compatibility and expect the |
Don't add a 3-tuple data type. Instead, only support this new data in the new dataclass. If you get a string, or a 2-tuple, convert it to the dataclass. Since |
5148434
to
416842a
Compare
Sorry for the noise with the force pushes, that should be good now. I refactored the I could use another review 🙏 |
<option>
HTML parameters can be set in SelectField
choices
argumentSelectField
choice refactoring
416842a
to
cc721a9
Compare
src/wtforms/fields/choices.py
Outdated
warnings.warn( | ||
"Passing SelectField choices as tuples is deprecated and will be " | ||
"removed in wtforms 3.3. Please use Choice instead.", | ||
DeprecationWarning, | ||
stacklevel=2, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reconsider this. It will be a significant amount of busy-work for larger projects to adapt to this, without any real benefit. Just generating the Choice instance from the tuple is cheap and doesn't seem to have any drawbacks.
Yeah... I really do not want to spend time updating those almost 50 places in my app.
f9337a5
to
5bc3653
Compare
5bc3653
to
fada111
Compare
This breaks a few libraries, including |
Fixes #692. Related to #381.
SelectField
choice
argument can take a list of 3 items tuples, the last one being a dict that will be rendered as<option>
HTML parameter.