only for reading
Just send this view to the client (read-only, without having to create objects from their deserialized view)
class OfficeSerializer(serializers.ModelSerializer): country = serializers.Field(source='country.iso')
As you can see, it will read, read country.iso from your office instance that will allow 'us' , for example, it will then be placed in a serializer key called 'country' if you output {'country': 'us'}
Writable Nested Field
Now, to complete this, write your own OfficeSerializer.create() :
def create(self, validated_data):
As for a OfficeSerializer.update() , it is similar:
def update(self, instance, validated_data):
source share