Skip to content

Preserve custom ChoiceField mappings for model choices - #10072

Open
G-Glitch404 wants to merge 3 commits into
encode:mainfrom
G-Glitch404:fix/9179-choice-field-mapping
Open

G-Glitch404 wants to merge 3 commits into
encode:mainfrom
G-Glitch404:fix/9179-choice-field-mapping

Conversation

@G-Glitch404

Copy link
Copy Markdown

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

This branch has not been deployed

No deployments
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.

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

1 participant