comment.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:sns_prj 作者: YongPilMoon 项目源码 文件源码
def perform_create(self, serializer):
        serializer.save()
        post = Post.objects.get(pk=self.kwargs.get('post_pk'))
        try:
            Alarm.objects.create(post=post, comment_author=self.request.user)
            post_pk = self.kwargs.get('post_pk')
            post = get_object_or_404(Post, pk=post_pk)
            registration_id = post.author.registration_id
            is_logined = Token.objects.filter(user=post.author)
            if registration_id and is_logined:
                message_body = "??? ? ? '{}'...? ??? ?????".format(post.content)
                messaging(message_body, post.pk, registration_id)
        except Exception as e:
            raise APIException({"detail": e.args})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号