def create(self, validated_data):
request = self.context['request']
user = request.user
Post= Post.objects.create(
parent=validated_data['parent_id'],
user=django_user.user,
text=validated_data['text'],
)
return Post
class PostCreateView(CreateAPIView):
queryset = models.Post.objects.all()
serializer_class = serializers.PostSerializer