I have two models , and I want to update them. When I update a field except ID ,it works fine. However, I can not update ID field of matrix cell object shown below.Also, I see ID field in get method.
class MatrixSerializer(serializers.ModelSerializer):
matrix_cell = MatrixCellSerializer(many=True)
class Meta:
model = Matrix
fields = ["id", ......, "matrix_cell"]
def update(self):
for m in matrix_cells:
m.get("id") #this return None
m.get("name") #but this works
class MatrixCellSerializer(serializers.ModelSerializer):
class Meta:
model = MatrixCell
fields = "__all__"