-
Notifications
You must be signed in to change notification settings - Fork 299
How to work with serializers.Serializer? #925
-
How to work with the base Serializer?
How to include it? How to give it a pk?
I saw that some code got deprecated at a point of a time: ab3fbfc#diff-52135bfc77d9d40d99d5451d1c64e64d75f0ae5bd338162064891dfcfc27b3b0L114
Currently, it shows as a simple JSON field in the returned data.
Beta Was this translation helpful? Give feedback.
All reactions
I think it can just live as a simple attribute, not as an included resource.
That's after a bit of thinking, and checking the folks at JSON:API forums.
Replies: 1 comment 1 reply
-
I think it can just live as a simple attribute, not as an included resource.
That's after a bit of thinking, and checking the folks at JSON:API forums.
Beta Was this translation helpful? Give feedback.
All reactions
-
You have two ways either you nest it as an attribute simply as nested serializer (possible since version 3.2.0) or you define its own endpoint and connect it with SerializerMethodResourceRelatedField.
In the latter case the object it handles need to have a pk property (also see #155) defining the primary key.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1