-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Add example using source=‘*’
to custom field docs.
#5688
Add example using source=‘*’
to custom field docs.
#5688
Conversation
docs/api-guide/fields.md
Outdated
|
||
The key points from the example, though, are: | ||
|
||
* `to_representation` is passed the entire `DataPoint` object must map from that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_representation
is passed the entire DataPoint
object , and must map from that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/api-guide/fields.md
Outdated
|
||
Note that this example doesn't handle validation. Partly for that reason, in a | ||
real project, the coordinate nesting might be better handled with a nested serialiser using two | ||
`IntegerField` instances, each with `source='*'`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if it'd be worth us demonstrating this at the end of this new section.
source='*'
is confusing to folks, so hammering home how to use it in non-custom-fields too might be helpful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I can add that example. 😃
9a806bb
to
5d40079
Compare
* Add example using `source=‘*’` to custom field docs. * Add nested serialiser example Closes encode#2032 closes encode#3066
Closes #2032 closes #3066
Adds an example using
source='*'
to create a nested representation from a flat object.Does that.