noodlebreak
This is my serializer: ``` class CategoryRecursiveSerializer(DynamicFieldsMixin, serializers.ModelSerializer): children = serializers.ListField(read_only=True, source='get_children', child=RecursiveField()) value = serializers.CharField(source='name', read_only=True) # hack requested by frontend parent = fields.CategoryField(queryset=models.Category.objects.all(), required=False, allow_null=True) ``` This is my request: ``` http://api.mlocal.com/api/v1/categories/?fields=id,value,children ``` This is my response: ``` { "count": 20, "next": null, "previous": null, "results": [ { "id": "5914220d-c455-45ff-a135-e9ac7f307dae", "value": "Fruits & Vegetables", "children": [ { "id": "7426afb3-b2b6-4f74-8a25-6e5e5865fb4f", "name": "Fresh Vegetables", "value": "Fresh Vegetables", "image": null, "is_featured": false, "children": [], "parent": { "id": "5914220d-c455-45ff-a135-e9ac7f307dae", "name": "Fruits & Vegetables", "image": "http://api.mlocal.com/categories/35629/fruits-vegetables-41698-1523944087.png", "is_featured": true, "parent": null, "created": "2018-07-17T09:27:42.920241Z" }, "created": "2018-07-17T09:28:32.731214Z" } ], "image": "http://api.mlocal.com/categories/35629/fruits-vegetables-41698-1523944087.png" } ] } ``` The `parent` field comes in nested children, except for the root objects in which only the fields that I mentioned come.