📜  如何将 ManyToManyField 保存为值而不是 id - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:41.241000             🧑  作者: Mango

代码示例1
class Symptoms(DynamicSerializer):
    class Meta:
        model = models.Symptom
        fields = ('name',) #< instead of id use other value


class PatientProfiel(DynamicSerializer):
    symptoms = SymptSer(many=True) #< it it here
    class Meta:
        model = MyModel
        fields = '__all__'