예제 #1
0
파일: post.py 프로젝트: guoyu07/firefly
 def get(self, id):
     post = Post.objects.get_or_404(id=id)
     Post.objects(id=id).update_one(inc__views=1)
     return render_template('posts/detail.html', post=post,
                            Markdown=Markdown, gen_author=gen_author,
                            gen_author_name=gen_author_name,
                            short_timesince=short_timesince)
예제 #2
0
파일: post.py 프로젝트: pino2046/firefly-1
 def get(self, id):
     post = Post.objects.get_or_404(id=id)
     Post.objects(id=id).update_one(inc__views=1)
     return render_template('posts/detail.html',
                            post=post,
                            Markdown=Markdown,
                            gen_author=gen_author,
                            gen_author_name=gen_author_name,
                            short_timesince=short_timesince)
예제 #3
0
파일: home.py 프로젝트: pino2046/firefly-1
    def post(self):
        ref_id = request.form.get('ref_id', 0)
        content = request.form.get('content')
        author = User.objects.get_or_404(id=current_user.id)
        c = Comment(ref_id=ref_id, content=content, author=author)
        c.save()
        context = Post.objects(id=int(ref_id))
        if not context:
            context = Comment.objects(id=int(ref_id))
            if not context:
                return jsonify(ok=1, msg='not exists')
        else:
            context = context[0]
            context.comments.append(c)
            context.save()

        return jsonify(ok=0)
예제 #4
0
파일: home.py 프로젝트: guoyu07/firefly
    def post(self):
        ref_id = request.form.get('ref_id', 0)
        content = request.form.get('content')
        author = User.objects.get_or_404(id=current_user.id)
        c = Comment(ref_id=ref_id, content=content, author=author)
        c.save()
        context = Post.objects(id=int(ref_id))
        if not context:
            context = Comment.objects(id=int(ref_id))
            if not context:
                return jsonify(ok=1, msg='not exists')
        else:
            context = context[0]
            context.comments.append(c)
            context.save()

        return jsonify(ok=0)
예제 #5
0
 def get(self, id):
     context = self.get_context(id)
     Post.objects(id=id).update_one(inc__views=1)
     return render_template('posts/detail.html', **context)
예제 #6
0
파일: post.py 프로젝트: IanZhao/firefly
 def get(self, id):
     post = Post.objects.get_or_404(id=id)
     Post.objects(id=id).update_one(inc__views=1)
     return render_template('posts/detail.html', post=post)