How can I count only replies on the every Comment?
tanveerahmad1517 opened this issue · 1 comments
tanveerahmad1517 commented
Please I want to show the replies number on every comment that are available replies
gameot commented
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