diff --git a/apps/news/models.py b/apps/news/models.py index bd0f3abe..ab65ed88 100644 --- a/apps/news/models.py +++ b/apps/news/models.py @@ -3,6 +3,7 @@ import uuid from django.conf import settings from django.contrib.contenttypes import fields as generic +from django.contrib.contenttypes.models import ContentType from django.contrib.postgres.fields import HStoreField from django.db import models from django.db.models import Case, When @@ -10,6 +11,7 @@ from django.utils import timezone from django.utils.translation import gettext_lazy as _ from rest_framework.reverse import reverse +from main.models import Carousel from rating.models import Rating, ViewCount from utils.models import (BaseAttributes, TJSONField, TranslatedFieldsMixin, HasTagsMixin, ProjectBaseMixin, GalleryModelMixin, IntermediateGalleryModelMixin, @@ -253,7 +255,12 @@ class News(GalleryModelMixin, BaseAttributes, TranslatedFieldsMixin, HasTagsMixi @property def must_of_the_week(self) -> bool: """Detects whether current item in carousel""" - return False + kwargs = { + 'content_type': ContentType.objects.get_for_model(self), + 'object_id': self.pk, + 'country': self.country, + } + return Carousel.objects.filter(**kwargs).exists() @property def publication_datetime(self):