-
-
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
Custom primary key serialization. #2789
Conversation
6e74d35
to
e8bca56
Compare
I'm a bit confused about this PR against #2788 |
This PR has little to do with #2788 #3000. Currently, the code in question assumes that the primary key's value is a primitive and passes it on to the json/xml/etc serializer to serialize. In the case of UUID's, this just calls This may not be the desired behaviour, so I've changed the foreign key field to accept an optional subfield, which can be used to customise the output representation of the foreign key's value. But it can be used to customise the output serialization of primary keys in general. ps. the implementation of this should have been independent to the implementation of #2788, but the unit tests rely on being able to serialise a UUID to a format other than the verbose hex format. |
Adds a 'pk_field' parameter which can be used to proxy serialization and deserialization of arbitrary primary key values.
e8bca56
to
a1e0bae
Compare
Rebased to use implementation from #3000. |
This looks good to me. Thanks for the work. |
Support custom serialization options for
PrimaryKeyRelatedField
s.