Skip to content

Update _Choices type for forms #2565

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

Merged
merged 2 commits into from
Mar 16, 2025

Conversation

mrgalopes
Copy link
Contributor

form.ChoiceField and other related fields accept the same input as the model's choices argument (https://docs.djangoproject.com/en/5.2/ref/forms/fields/#django.forms.ChoiceField.choices). This updates the typing for the form to be the same as the models'.

Let me know what you think. Thanks!

Refs #2476

form.ChoiceField and other related fields accept the same input as the model's choices argument (https://docs.djangoproject.com/en/5.2/ref/forms/fields/#django.forms.ChoiceField.choices)
Ref: typeddjango#2476
from django.utils.choices import BlankChoiceIterator, _Choice, _ChoiceNamedGroup, _ChoicesCallable, _ChoicesMapping
from django.utils.choices import _Choices as _ChoicesSequence
from django.utils.choices import BlankChoiceIterator, _Choice, _ChoiceNamedGroup, _ChoicesCallable
from django.utils.choices import _ChoicesInput as _Choices
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not do an alias here, it is a bit confusing.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sobolevn sobolevn merged commit 865b668 into typeddjango:master Mar 16, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants