fix main_image for news

(cherry picked from commit 8ca213a)
This commit is contained in:
Kuroshini 2019-12-25 13:48:04 +03:00
parent 670da807af
commit 432873da31

View File

@ -307,7 +307,7 @@ class News(GalleryMixin, BaseAttributes, TranslatedFieldsMixin, HasTagsMixin,
def main_image(self):
qs = self.news_gallery.main_image()
if qs.exists():
return qs.first().image
return qs.order_by('-id').first().image
@property
def image_url(self):