-
Notifications
You must be signed in to change notification settings - Fork 299
Added support for adding meta objects from serializers #170
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
Conversation
Nice work here @jerel :)
6c5494b
to
7d43eb8
Compare
This is ready for review and feedback or merge
84457c9
to
73130e3
Compare
Added support for adding meta objects from serializers
It seems, this does not work as expected.
I have extended rest_framework_json_api.serializers.ModelSerializer
, added rest_framework_json_api.serializers.SerializerMethodField
and get_my_field
method to the serializer, and added my_field
to Meta
's meta_fields
. However, instead of meta
, my_field
has appeared inside data
.
get_root_meta
on the serializer does nothing, either.
I think you should open a PR with a failing test
Solves #154.
By declaring a
meta_fields
property on the serializer'sMeta
class meta data can be added to the:meta
key of each item in a list serializer (a blog entry)meta
key of a single data object (a blog)By declaring a
get_root_meta
function on a serializer data can be added to the:meta
object