# HG changeset patch # User neko259 # Date 2015-11-23 09:53:09 # Node ID f79d6211fa76a86ba947e62d516db550ddebb1d0 # Parent ad1a3f8ec903b9bab1ce3a6c2850e13989f1b117 Fixed random tag image diff --git a/boards/models/tag.py b/boards/models/tag.py --- a/boards/models/tag.py +++ b/boards/models/tag.py @@ -105,11 +105,11 @@ class Tag(models.Model, Viewable): def get_description(self): return self.description - def get_random_image_post(self, status=False): + def get_random_image_post(self, status=[STATUS_ACTIVE, STATUS_BUMPLIMIT]): posts = boards.models.Post.objects.annotate(images_count=Count( 'images')).filter(images_count__gt=0, threads__tags__in=[self]) if status is not None: - posts = posts.filter(thread__status=status) + posts = posts.filter(thread__status__in=status) return posts.order_by('?').first() def get_first_letter(self):