Geben Sie den Benutzer an Serializer Django Rest Framework weiter
class CommentSerializer(serializers.Serializer):
...
def create(self, validated_data):
user = self.context['request'].user
comment = Comment.objects.create(
user=user,
**validated_data
)
return comment
Tural Novruzov