honzakral/django-threadedcomments

How can I count only replies on the every Comment?

Opened this issue · 1 comments

Please I want to show the replies number on every comment that are available replies

extend model like this:

from threadedcomments.models import ThreadedComment as BaseModel
class ThreadedCommentExt(BaseModel):
    class Meta:
        verbose_name = _("Comment")
        verbose_name_plural = _("Comments")
        proxy = True
        managed = False

    def get_replies_count(self):
        count = 0
        comments = ThreadedCommentExt.objects.filter(parent=self)
        for item in comments:
            count += item.get_replies_count() + 1
        return count