Content Model¶
Article¶
-
class
Article¶ 文章
-
title¶ 标题
-
content¶ 正文
-
summary¶ 简介
-
image¶ 封面图片
-
classmethod
url()¶ 返回文章url
-
classmethod
get_absolute_url()¶ 返回文章url
-
classmethod
last_article()¶ 上一篇,返回:
{ 'title': 'xx', 'id' : 12, 'url' : '/article/12' }
-
classmethod
next_article()¶ 下一篇,返回:
{ 'title': 'xx', 'id' : 12, 'url' : '/article/12' }
-
classmethod
meta_data()¶ 返回ArticleMeta
-
classmethod
category()¶ 返回文章的分类
返回文章的tag
-
classmethod
comments()¶ 返回评论
-
classmethod
format_comments()¶ 返回按父子关系整理后的评论:
[ { 'comment' : Comment , 'children':[ {'comment' : Comment, 'to_nickname':'xx'} , { ... } ] }, {...} ]
-
Category¶
Tag¶
Comment¶
-
class
Comment¶ 评论
-
nickname¶
-
email¶
-
content¶ 正文
-
type¶ 评论类型
201 : 对文章评论
202 : 对评论评论
-
root_id¶ 根评论id。对文章评论时,这一项无意义。对评论回复时就是评论的id,对回复回复时,是最早的那条评论id。
-
to_id¶ 给谁的评论。对文章评论时,这一项无意义。
注解
以下说的 评论、回复 其实是一个东西,方便区分用了两个词 评论:对文章的评论称作 "评论"; 回复:对评论的评论称作 "回复",对回复的回复也叫 "回复"; 注意区分root_id和to_id, 评论 root_id必须是-1 对评论的回复 root_id==to_id 如: 文章-0 |__ 评论-1 |__ 回复-2 |__ 回复-3 |__ 回复-3-1 评论-1 :root_id是 文章-0 的id 回复-2 :root_id是 评论-1 的id; to_id是 评论-1 的id; 回复-3 :root_id是 评论-1 的id; to_id是 评论-1 的id; 回复-3-1 :root_id是 评论-1 的id; to_id是 回复-3 的id;-