django-rest-marshmallow
django-rest-marshmallow copied to clipboard
fields.Pluck does not work as expected
Code
class LSerializer(Schema):
id = fields.Integer()
last_name = fields.String()
first_name = fields.String()
class RSerializer(Schema):
id = fields.Integer()
last_name = fields.Pluck(LSerializer, 'last_name')
first_name = fields.Pluck(LSerializer, 'first_name')
occupation = fields.String()
Response
{
"id": 1
"occupation": "Student"
}
Expected Response
{
"id": 1,
"first_name": "John",
"last_name": "Appleseed",
"occupation": "Student"
}
Pluck does not seem to work as expected or I'm not sure if I'm missing anything!