Django threadedcomments - how can I respond to a comment?

I am trying to integrate threadedcommetns into my Django application and have difficulty with uncertainty about how this works. Here's what my template looks like (based on an example from the tutorial ):

<h3>Comments on This Post:</h3>
{% get_threaded_comment_tree for post as tree %}
{% for comment in tree %}
    <div style="margin-left: {{ comment.depth }}em;" class="comment">
        {% link_to_profile comment.user %}
        {% auto_transform_markup comment %}
    </div>
{% endfor %}
<p>Reply to Original:</p>
<form method="POST" action="{% get_comment_url post %}">
    {% csrf_token %}
    <ul>
        {% get_threaded_comment_form as form %}
        {{ form.as_ul }}
        <li><input type="submit" value="Submit Comment" /></li>
    </ul>
</form>

So, if these are streaming comments, how do I respond to a comment that someone has already left? Where is the form for this? I managed to get the form Reply to Original, but comments are not related to this at all.

I will be very grateful for your help.

PS Actually, I'm not very happy with how this application works with django 1.3, so suggesting an alternative would be a great answer.

+3
source share
3 answers

, django threadedcommetns :)

: django-mptt

, , django django-mptt: http://codeblogging.net/blogs/1/3/

+6

div id_parent, id.

jQuery - :

$('#commentForm').find("#id_parent").attr("value", divid);
+3

.

<form method="POST" action="{% get_comment_url post %}">
    {% csrf_token %}
    <ul>
        {% get_threaded_comment_form as form %}
        {{ form.as_ul }}
        <li><input type="submit" value="Submit Comment" /></li>
    </ul>
</form>

, threaded.

<div class="bulk">
    {% get_threaded_comment_tree for post as tree %}
        {% for comment in tree %}
            <div style="margin-left:{{comment.depth}}em;">
                {{comment}}
                Reply to this comment
                <form action="{% get_comment_url post comment %}" method="POST">
                    <ul>
                        {% get_threaded_comment_form as form %}
                        {{ form.as_ul }}
                        <li><input type="submit" value="Submit Reply" /></li>
                    </ul>
                </form>
            </div>
        {% endfor %}
</div>

, . URL {% get_comment_url post comment %}. , , . , , . {{comment}}, .

So, if you want "Reply for original," you use {% get_comment_url post %}.

And if you want to answer for a specific comment, you use {% get_comment_url post comment %}.

+1
source

All Articles