Add rating unique value
This commit is contained in:
parent
14cf7d7b1b
commit
9fd064fdec
|
|
@ -30,7 +30,7 @@ class NewsQuerySet(models.QuerySet):
|
||||||
"""QuerySet for model News"""
|
"""QuerySet for model News"""
|
||||||
|
|
||||||
def rating_value(self):
|
def rating_value(self):
|
||||||
return self.annotate(rating=models.Count('ratings'))
|
return self.annotate(rating=models.Count('ratings__ip', distinct=True))
|
||||||
|
|
||||||
def with_base_related(self):
|
def with_base_related(self):
|
||||||
"""Return qs with related objects."""
|
"""Return qs with related objects."""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user