Open flyly0755 opened 2 years ago
I have one model with a field which is self related,
class zi(models.Model): """汉字数据模型""" chszi = models.CharField(max_length=1, null=False, blank=False, verbose_name="汉字", unique=True) relatedzi = models.ManyToManyField("self", null=True, blank=True, related_name="rzi", symmetrical=True, verbose_name='关联字') class RelatedZiSerializer(serializers.ModelSerializer): """关联汉字的序列化""" class Meta: model = zi fields = ['id', 'chszi'] class ziDetialSerializer(WritableNestedModelSerializer, serializers.ModelSerializer): """汉字详情的序列化""" relatedzi = RelatedZiSerializer(many=True)
with code above, send a put request to update it, but with error showed below:
how to solve this problem?
I have one model with a field which is self related,
with code above, send a put request to update it, but with error showed below:
how to solve this problem?