开发者

django threadedcomment setup

im trying to use django threaded comments however im stuck in how to corre开发者_如何学Goctly set values in this:

{% get_comment_form for [object] as [varname] with [parent_id] %}

{% get_comment_form for [app].[model] [object_id] as [varname] with [parent_id] %}
{% render_comment_form for [object] with [parent_id] %}
{% render_comment_form for [app].[model] [object_id] with [parent_id] %}.

can someone pls point me to a complete tutorial in setting this up.


I don't know of any good tutorials, but it's pretty straight forward as using the template tags. It is exactly like using the built-in comments template tags with the exception of parent_id, since we need to know which comment you are replying to.

Let's say you have a blog app and you are passing a Post object through your views. Let's call this object post.

To render the main comment form for the post object:

{% render_comment_form for post %}

You will be able to make comments that are related to this post object.

Then, to render the comment form for each individual comment (or the "reply" if you will), you can use the same template tag but pass in the parent_id of the comment:

{% render_comment_form for post with comment.id %}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜