Skip to content

Preserve custom ChoiceField mappings for model choices - #10072

Merged
auvipy merged 4 commits into
encode:mainfrom
G-Glitch404:fix/9179-choice-field-mapping
Nov 19, 2026
Merged

auvipy merged 4 commits into
encode:mainfrom
G-Glitch404:fix/9179-choice-field-mapping

Conversation

@G-Glitch404

Copy link
Copy Markdown
Contributor

Summary

Preserve custom ChoiceField subclasses registered through serializer_field_mapping when the corresponding model field defines choices.

Changes

  • Only coerce mapped fields to serializer_choice_field when the mapped class is not already a ChoiceField subclass.
  • Add a regression test covering custom ChoiceField mappings for model fields with choices.

Fixes #9179

@auvipy auvipy added this to the 3.19 milestone Nov 19, 2026
@auvipy auvipy modified the milestones: 3.19, 3.18 Nov 19, 2026
@auvipy auvipy added the Bug label Nov 19, 2026
@auvipy
auvipy merged commit 59de147 into encode:main Nov 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Not possible to override serializer_field_mappings with a field that has choices (for example a from ChoiceField derived field)

2 participants