Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Add example usingsource=‘*’ to custom field docs.#5688
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Add example usingsource=‘*’ to custom field docs.#5688
Uh oh!
There was an error while loading.Please reload this page.
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 entireDataPoint 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 to5d40079Compare* Add example using `source=‘*’` to custom field docs.* Add nested serialiser exampleClosesencode#2032closesencode#3066
Closes#2032closes#3066
Adds an example using
source='*'to create a nested representation from a flat object.Does that.