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

Update _Choices type alias #2368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joaoseckler
Copy link

@joaoseckler joaoseckler commented Sep 11, 2024

Updating the _Choices type alias

Django 5 allows model field choices to be callables, mappings or subclasses of models.Choices. This PR introduces these options in the stubs.

Related issues

No related issues

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.

Please, add several tests for that.

@joaoseckler joaoseckler marked this pull request as draft September 11, 2024 16:06
@joaoseckler joaoseckler force-pushed the django5-choices branch 4 times, most recently from 4a6dc8e to a162237 Compare September 11, 2024 19:51
@joaoseckler
Copy link
Author

@sobolevn, thanks for the obvious feedback. I've reduced the scope of the PR to change only the _Choices type for model fields. I've added typecheck tests and assert_type tests. Any feedback is welcome, as this is my first contribution to the repository. Thanks!

@joaoseckler joaoseckler marked this pull request as ready for review September 11, 2024 19:52
@sobolevn sobolevn requested a review from intgr September 11, 2024 20:17
@joaoseckler joaoseckler force-pushed the django5-choices branch 2 times, most recently from 9f5ef89 to 46b8648 Compare September 16, 2024 14:27
@joaoseckler
Copy link
Author

Hey, sorry for the amount of force-pushes and failed tests. I must have gotten something wrong with my environment, because the test suite was passing locally since the beginning, even though the errors are quite simple

Django 5 allows model field choices to be callables, mappings or
subclasses of models.Choices. This commit introduces these options in
the stubs.
@sobolevn
Copy link
Member

sobolevn commented Dec 5, 2024

Please, fix the merge conflict :)

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