queryset = Comment.objects.all()
serializer_class = CommentSerializer
parser_classes = [JSONParser]
def get_serializer(self, data):
post_id = self.kwargs['pk']
data = [
{'text': self.request.data['text'], 'owner': self.request.user.pk, 'post': post_id}
]
return super().get_serializer(data=data, many=True)
"owner": [
"This field may not be null."
]
owner не nullable в бд
Обсуждают сегодня