##// END OF EJS Templates
Small changes to queries
neko259 -
r395:f18b32bd default
parent child Browse files
Show More
@@ -136,11 +136,6 b' class PostManager(models.Manager):'
136
136
137 return thread
137 return thread
138
138
139 def exists(self, post_id):
140 posts = self.filter(id=post_id)
141
142 return posts.count() > 0
143
144 def get_thread_page_count(self, tag=None):
139 def get_thread_page_count(self, tag=None):
145 if tag:
140 if tag:
146 threads = self.filter(thread=None, tags=tag)
141 threads = self.filter(thread=None, tags=tag)
@@ -56,7 +56,7 b' class User(models.Model):'
56 tags = self.fav_tags.annotate(Count('threads')) \
56 tags = self.fav_tags.annotate(Count('threads')) \
57 .filter(threads__count__gt=0).order_by('name')
57 .filter(threads__count__gt=0).order_by('name')
58
58
59 if tags:
59 if tags.exists():
60 cache.set(cache_key, tags, settings.CACHE_TIMEOUT)
60 cache.set(cache_key, tags, settings.CACHE_TIMEOUT)
61
61
62 return tags
62 return tags
General Comments 0
You need to be logged in to leave comments. Login now