diff --git a/app/models.py b/app/models.py index a656e06d8001905f541a082a364260c1077b1f66..e9342e03f9a505c772a6b65a21dcde6175ed425a 100644 --- a/app/models.py +++ b/app/models.py @@ -99,6 +99,11 @@ class Materi(models.Model): def like_count(self): count = Like.objects.filter(materi=self).count() return count + + @property + def comment_count(self): + count = Comment.objects.filter(materi=self).count() + return count @property def is_like(self): diff --git a/app/templates/app/detail_materi.html b/app/templates/app/detail_materi.html index 577e65bfb1f077a306962335a64b9202c1b90254..8543206be10ca70cb4af7325f00aa95ce5b3d4da 100644 --- a/app/templates/app/detail_materi.html +++ b/app/templates/app/detail_materi.html @@ -268,6 +268,7 @@ {% if materi_data.status == "APPROVE" %}
Komentar ({{ materi_data.comment_count }})
{% if is_authenticated %}