DjangoRestMultipleModels icon indicating copy to clipboard operation
DjangoRestMultipleModels copied to clipboard

Is there a way to mix single object and list ?

Open keomabrun opened this issue 5 years ago • 0 comments

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.

keomabrun avatar Sep 17 '19 12:09 keomabrun