class UserSerializer(UniqueFieldsMixin, serializers.ModelSerializer):
class Meta:
model = User
fields = ("username", "email", "first_name", "last_name")
class OrganizationSerializer(WritableNestedModelSerializer):
user = UserSerializer(source="owner.organization_user.user")
class Meta:
model = Organization
fields = ("name", "user")
I have serializer like this. The user in Organization is a very deep relation. Getting error
Cannot assign "{'organization_user': {'user': OrderedDict([('username', 'username'), ('email', 'test@test.com'), ('first_name', 'Test'), ('last_name', 'Test')])}}": "Organization.owner" must be a "OrganizationOwner" instance.
I have serializer like this. The user in Organization is a very deep relation. Getting error