Обновление до следующей модели новостей не работает в DRF. (Адрес не обновляется) Создание работает нормально.
class News (models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=20)
text = models.TextField()
group_address = models.ManyToManyField(Group, blank=True)
user_address = models.ForeignKey(User, on_delete=models.CASCADE)
class Group(models.Model):
id = models.AutoField(primary_key=True)
group_name = models.CharField(max_length=20)
class User(models.Model):
id = models.AutoField(primary_key=True)
user_name = models.CharField(max_length=20)
class NewsSerializerViewSet(viewsets.ModelViewSet):
queryset = News.objects.all()
serializer_class = NewsSerializer
class NewsSerializer(serializers.ModelSerializer):
class Meta:
model = News
fields = '__all__'