Suggestion about the behavior of the get_value method in the Serializer class. #9621
Unanswered
hanlsin
asked this question in
Ideas & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
sourceinFieldclass is described as 'The name of the attribute that will be used to populate the field.' However, couldn't it be generalized for broader use?Currently,
get_valueinSerializerandFieldclass retrieves the value from the dictionary using onlyfield_nameas the key, but ifsourceis specified and differs fromfield_name, it seems like usingsourceas the key to find the value would be a good approach.For example,
Overriding the
get_valuemethod, of course, could be straightforward to support this functionality.However, I wonder if supporting this as the default behavior might be a more user-friendly approach.
Are there any potential issues with using it this way?
Beta Was this translation helpful? Give feedback.
All reactions