add - parent to org

This commit is contained in:
2025-11-04 11:21:47 +03:30
parent 3c85d92c92
commit c2de185a26
3 changed files with 35 additions and 0 deletions

View File

@@ -203,12 +203,22 @@ class OrganizationTypeSerializer(serializers.ModelSerializer):
model = OrganizationType
fields = [
'id',
'parent',
'key',
'name',
'org_type_field',
'is_repeatable'
]
def to_representation(self, instance):
representation = super().to_representation(instance)
if instance.parent:
representation['parent'] = {
'name': instance.parent.name,
'id': instance.parent.id
}
class OrganizationSerializer(serializers.ModelSerializer):
""" Serialize organization data """