-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
It would be nice to be able to access child serializers from their parent and have them work as fully functional serializer instances. Using serializer_instance.fields['<child_name>'] gets the right serializer, but it doesn't have data or a model instance associated with it. From the child serializer, you have to do something like self.parent.instance.<child_relation> to access the model instance.
I understand that there is no intention to support nested writes/updates, but is changing the nesting structure of serializers something that might be done? I think a dynamic-programming-inspired approach would be more intuitive.
BaseSerializer is already a subclass of Field, so it should be possible. I haven't looked into how much of a rewrite it would require, as I wanted to get people's reactions first. Is there a solid reason things aren't done this way?