-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
More documentation on source='*' for Serializer fields #2032
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Yup totally agree we should have fuller documentation on Not too fussed about that in the particular context of Here's an example of using the source='*' Say we have a model like so:
Now say that we wanted to split out the 'phone' and 'email' from the rest of the representation and end up with an output that looks like this:
We can do so by using an AddressSerializer and ContactDetailsSerializer, and passing them the complete
This serializer would also handle reconstructing updates from the split dictionary style, restoring all the attributes into a single dictionary that can be used to create or update a And yes, more docs on this. |
More examples are always useful but would you then want to add an example for each of the serializer field core arguments (currently there is an example for the style argument only)? |
@ssbrewster If someone wants to take it on, then yes. Otherwise, not a huge priority. |
* Add example using `source=‘*’` to custom field docs. * Add nested serialiser example Closes encode#2032 closes encode#3066
Right now the docs for the special value just say:
And as far as the
PaginationSerializer
, the entire implementation is just this.What exactly does the
*
do and what would happen in the case ofPaginationSerializer
if it were omitted?The text was updated successfully, but these errors were encountered: