Open serlesen opened 4 years ago
This can be done with a more complex manual mapping as described in the following issue: https://stackoverflow.com/questions/62515255/how-to-serialize-a-nested-object-with-the-many-to-one-relationship-in-one-side/62539383#62539383
Having those two objects:
I want, when returning the basket item, have the product serialized inside, not only the ID. Here are the ModelSchema i've used:
This will serialize something like:
[{'id': 1, 'product': 123}]
Add some flag in the Meta declaration to allow serializing the following:[{'id': 1, 'product': {'id': 123, 'name': 'first'}}]