DjangoRestMultipleModels
DjangoRestMultipleModels copied to clipboard
Is there a way to mix single object and list ?
Example:
{
"Play" : {"genre": "Comedy", "title": "A Midsummer Night"s Dream", "pages": 350},
"Poem" : [
{"title": "Shall I compare thee to a summer"s day", "stanzas": 1},
{"title": "As a decrepit father takes delight", "stanzas": 1},
....
],
}
So far I've managed to achieve it by adding a many=[True|False]
argument, and modifying the serializer call, but I wonder if there is another (already existing) way.