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 %}
精彩评论