I have a comments model that is setup to do threaded replies. I am
having trouble figuring out how to display the comments in a threaded
manner, i.e. tree.
My model looks like this:
class Comment(models.Model):
post = models.ForeignKey(Post, null=True, blank=True)
user = models.ForeignKey(User, null=True, blank=True)
comment = models.TextField(null=True, blank=True)
parent = models.ForeignKey('self', null=True, blank=True,
default=None,
related_name='children')
node = models.CharField(null=True, blank=True, default=None,
max_length=1024)
created = models.DateTimeField(auto_now_add=True, editable=False)
When I sort by node, I get the correct order of comments.
I was hoping someone has an idea of how to iterate through the
comments for a particular post, and have them appear as a tree.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.