Q:

how to display number of comments in django

I'm just little bit confused, I have two models 
class Comment(models.Model):
    user = models.ForeignKey(MyProfile)
    parent = models.ForeignKey("self", null=True, blank=True)
    path = models.CharField(max_length=350)
    post = models.ForeignKey(Post, null=True, blank=True, related_name="commented_post")
    text = models.TextField()

And 
class Post(models.Model):
    #comment = models.ForeignKey(Comment)if I do this I get an error but how do I display the number of comments? I was thinking to do {{post.comment.count}}

I tried adding the following function under comment model
@property
    def get_comment_count(self):
        return self.comment.count

but this doesn't do the job, I think I have to use something like {{comment.post.count}}maybe...any help please..

A:

It looks like you're trying to get the number of comments for a specific post, you can do comments_count = Comment.objects.filter(post=mypost).count()

