Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django threadedcomments - how do I reply to a comment?

I am trying to integrate threadedcommetns to my Django app and having trouble in uderstanding how it works. Here is how my template looks (based on example from 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 those are threaded comments, how do I reply to a comment that is already left by someone? Where is the form for that? I only managed to get Reply to Original form, but with this, comments are not threaded at all.

I would be very grateful for your help.

P.S. Actually,I am not very happy how this app is working with django 1.3, so suggesting an alternative would be a great answer too.

like image 741
Silver Light Avatar asked Aug 12 '26 15:08

Silver Light


2 Answers

Seems like django threadedcommetns are not very popular here :)

I've found a great library: django-mptt

Here is my tutorial that describes how to implement threaded comments in django using django-mptt: http://codeblogging.net/blogs/1/3/

like image 68
Silver Light Avatar answered Aug 15 '26 04:08

Silver Light


There is a "id_parent" div in the form, change the value to the parent's id.

with jQuery something like this:

$('#commentForm').find("#id_parent").attr("value", divid);
like image 38
deepsight Avatar answered Aug 15 '26 04:08

deepsight



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!