class UOMCategorySerializer(ModelSerializer):


    class Meta:
        model = UOMCategory
fields = 'name', 'description', 'parent', 'children'
How to serialize hierarchical relationship in Django REST