コード例 #1
0
ファイル: classes.py プロジェクト: rafaelnunes/goo-course
    def comment_video(self):
        comment = self.request.get('comment')
        time = self.request.get('time')
        video = self.request.get('video')

        vcomment = VideoComment(profile=self.logged.key, video_id=video, video_time=time, comment=comment)
        vcomment.put()

        return self.render_json({'success': True, 'comment': comment, 'time': time, 'id': vcomment.key.id()})
コード例 #2
0
ファイル: classes.py プロジェクト: rafaelnunes/goo-course
    def get_video_comments(self):
        video = self.request.get('video')
        comments = VideoComment.query(VideoComment.profile == self.logged.key, VideoComment.video_id == video).order(VideoComment.created_at).fetch()

        json_comments = []
        for com in comments:
            json_comments.append({
                'comment': com.comment,
                'time': com.video_time,
                'id': com.key.id(),
            })

        return self.render_json({'comments': json_comments})