diff --git a/boards/models/tag.py b/boards/models/tag.py --- a/boards/models/tag.py +++ b/boards/models/tag.py @@ -4,6 +4,7 @@ from django.db.models import Count from django.core.urlresolvers import reverse from boards.models.base import Viewable +from boards.utils import cached_result __author__ = 'neko259' @@ -70,5 +71,6 @@ class Tag(models.Model, Viewable): 'tag': self, }) + @cached_result def get_post_count(self): return self.get_threads().aggregate(num_posts=Count('post'))['num_posts']