[Django]-'TreeQuerySet' object has no attribute 'name'

2👍

TreeQuerySet is in fact a subclass of QuerySet

categories = category.get_children()

returns multiple Category objects but you are trying to serialize single instance, instead you should serialize a QuerySet with additional parameter in serializer many=true

categories_serializer = SubCategorySerializer(categories, many=true, context={'request': request})

Leave a comment