DRFで下記Newsモデルへの更新が動作しません。
作成は正常に動きます。
Model
1class News (models.Model): 2 id = models.AutoField(primary_key=True) 3 title = models.CharField(max_length=20) 4 text = models.TextField() 5 address = models.ManyToManyField(Group, blank=True) 6 7class Group(models.Model): 8 id = models.AutoField(primary_key=True) 9 group_name = models.CharField(max_length=20)
ViewSet
1class NewsSerializerViewSet(viewsets.ModelViewSet): 2 queryset = News.objects.all() 3 serializer_class = NewsSerializer 4
Serializer
1class NewsSerializer(serializers.ModelSerializer): 2 class Meta: 3 model = News 4 fields = '__all__'
あなたの回答
tips
プレビュー