def get_blog(id, request):
user = request.__user__
cats = await Category.findAll(orderBy='created_at desc')
blog = await Blog.find(id)
blog.view_count = blog.view_count + 1
await blog.update()
comments = await Comment.findAll(where='blog_id=?', args=[id], orderBy='created_at desc')
for c in comments:
c.html_content = markdown(c.content, extras=['code-friendly', 'fenced-code-blocks'])
blog.html_content = markdown(blog.content, extras=['code-friendly', 'fenced-code-blocks'])
return {
'__template__': 'blog.html',
'web_meta': configs.web_meta,
'user': user,
'cats': cats,
'blog': blog,
'comments': comments,
'disqus': configs.use_disqus
}
评论列表
文章目录