# HG changeset patch # User neko259 # Date 2016-05-21 10:23:19 # Node ID af1d8bd17a8a080edd877e618714e9363939376b # Parent 0eb7ac3c51909d0b4220c24b8e8b532328587354 Fixed issues with new images storage diff --git a/boards/models/tag.py b/boards/models/tag.py --- a/boards/models/tag.py +++ b/boards/models/tag.py @@ -146,5 +146,5 @@ class Tag(models.Model, Viewable): def get_images(self): return Attachment.objects.filter( - post_attachments__thread__tags__in=[self]).filter( - mimetype__in=FILE_TYPES_IMAGE).order_by('-post_images__pub_time') \ No newline at end of file + attachment_posts__thread__tags__in=[self]).filter( + mimetype__in=FILE_TYPES_IMAGE).order_by('-attachment_posts__pub_time') \ No newline at end of file diff --git a/boards/models/thread.py b/boards/models/thread.py --- a/boards/models/thread.py +++ b/boards/models/thread.py @@ -142,7 +142,7 @@ class Thread(models.Model): return self.get_replies().filter( attachments__mimetype__in=FILE_TYPES_IMAGE)\ .annotate(images_count=Count( - 'attachments')).aggregate(Sum('images_count'))['images_count__sum'] + 'attachments')).aggregate(Sum('images_count'))['images_count__sum'] or 0 def can_bump(self) -> bool: """