MattBroach / DjangoRestMultipleModels

View (and mixin) for serializing multiple models or querysets in Django Rest Framework
MIT License
549 stars 67 forks source link

Outdated document content #44

Closed CharmNight closed 5 years ago

CharmNight commented 5 years ago

https://django-rest-multiple-models.readthedocs.io/en/latest/flat-options.html

from drf_multiple_model.views import FlatMultipleModelAPIView

class TextAPIView(FlatMultipleModelAPIView):
    querylist = [
        {
            'querylist': Play.objects.all(),
            'serializer_class': PlaySerializer,
            'label': 'drama',
        },
        {
            'querylist': Poem.objects.filter(style='Sonnet'),
            'serializer_class': PoemSerializer,
            'label': 'sonnet'
        },
        ....
    ]

When I follow the above, I get an error ['All items in the MyDemoAPI querylist attribute should contain a queryset key']

rlabrecque commented 5 years ago

https://github.com/MattBroach/DjangoRestMultipleModels/pull/43

MattBroach commented 5 years ago

Just confirming that yes, as @rlabrecque pointed out, this is an error the documentation. If you instead use queryset instead of querylist inside each dict object, it should work as intended. The documentation has been updated to correct this error, and sorry for the confusion.