##// END OF EJS Templates
Fixed random tag image
neko259 -
r1417:f79d6211 default
parent child Browse files
Show More
@@ -105,11 +105,11 b' class Tag(models.Model, Viewable):'
105 def get_description(self):
105 def get_description(self):
106 return self.description
106 return self.description
107
107
108 def get_random_image_post(self, status=False):
108 def get_random_image_post(self, status=[STATUS_ACTIVE, STATUS_BUMPLIMIT]):
109 posts = boards.models.Post.objects.annotate(images_count=Count(
109 posts = boards.models.Post.objects.annotate(images_count=Count(
110 'images')).filter(images_count__gt=0, threads__tags__in=[self])
110 'images')).filter(images_count__gt=0, threads__tags__in=[self])
111 if status is not None:
111 if status is not None:
112 posts = posts.filter(thread__status=status)
112 posts = posts.filter(thread__status__in=status)
113 return posts.order_by('?').first()
113 return posts.order_by('?').first()
114
114
115 def get_first_letter(self):
115 def get_first_letter(self):
General Comments 0
You need to be logged in to leave comments. Login now