[Django]-What does 'many = True' do in Django Rest FrameWork?

52👍

I think you are confusing many=True with many to many realtionship, but the concepts is not like that

by setting many=True you tell drf that queryset contains mutiple items (a list of items) so drf needs to serialize each item with serializer class (and serializer.data will be a list)

if you don’t set this argument it means queryset is a single instance and serializer.data will be a single object)

👤aliva

Leave a comment