Return helpful/unhelpful votes from the Review model
This commit is contained in:
parent
4e59b1710a
commit
57ad0f20e0
|
@ -63,11 +63,11 @@ class Review(models.Model):
|
|||
|
||||
# Gets the total number of votes which marked this review as 'helpful'.
|
||||
def getHelpfulVoteCount(self):
|
||||
ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=True).count()
|
||||
return ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=True).count()
|
||||
|
||||
# Gets the total number of votes which marked this review as 'unhelpful'.
|
||||
def getUnhelpfulVoteCount(self):
|
||||
ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=False).count()
|
||||
return ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=False).count()
|
||||
|
||||
# A vote for a review as either positive or negative.
|
||||
class ReviewHelpfulVote(models.Model):
|
||||
|
|
Loading…
Reference in New Issue