Repository navigation
Accept every choices input on file, related, array and GIS fields - #3756
Merged
UnknownPlatypus merged 1 commit intoOct 25, 2026
Merged
Conversation
sobolevn
approved these changes
Oct 25, 2026
`Field.__init__` and the scalar fields already take `choices: _ChoicesInput` (a `Choices` class, a mapping, a callable or an iterable of pairs), like Django does.
`FileField`, the related fields, `ArrayField` and the GIS fields still took the narrower `_Choices` iterable, so `FileField(choices=Kind)`, `ForeignKey(..., choices={...})` or a callable were rejected.
Ported from sbdchd#408
- [ ] I have read and agree to the [AI Policy](https://github.com/typeddjango/django-stubs/blob/master/.github/AI_POLICY.md), removed any "Co-Authored-By" lines attributing coding agents, and manually reviewed the final result
UnknownPlatypus
force-pushed
the
field-choices-input
branch
from
October 25, 2026 20:18
2ce98c2 to
6ea9f38
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have made things!
Field.__init__already usechoices: _ChoicesInputbutFileField, the related fields,ArrayFieldand the GIS fields still took the narrower_Choicesiterable, soFileField(choices=Kind),ForeignKey(..., choices={...})or a callable were rejected.I've migrated the
tests/typecheck/db/models/test_fields_choices.ymltest to get better coverage too for other typecheckers and linked a ty issue causing incorrect ignoresRelated issues
Ported from sbdchd#408
AI Policy