##// END OF EJS Templates
Cache tag post count
neko259 -
r973:110ab3b8 default
parent child Browse files
Show More
@@ -4,6 +4,7 b' from django.db.models import Count'
4 4 from django.core.urlresolvers import reverse
5 5
6 6 from boards.models.base import Viewable
7 from boards.utils import cached_result
7 8
8 9
9 10 __author__ = 'neko259'
@@ -70,5 +71,6 b' class Tag(models.Model, Viewable):'
70 71 'tag': self,
71 72 })
72 73
74 @cached_result
73 75 def get_post_count(self):
74 76 return self.get_threads().aggregate(num_posts=Count('post'))['num_posts']
General Comments 0
You need to be logged in to leave comments. Login now