must of the week logic
This commit is contained in:
parent
bfd8044b47
commit
794ac84838
|
|
@ -3,6 +3,7 @@ import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes import fields as generic
|
from django.contrib.contenttypes import fields as generic
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.postgres.fields import HStoreField
|
from django.contrib.postgres.fields import HStoreField
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Case, When
|
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 django.utils.translation import gettext_lazy as _
|
||||||
from rest_framework.reverse import reverse
|
from rest_framework.reverse import reverse
|
||||||
|
|
||||||
|
from main.models import Carousel
|
||||||
from rating.models import Rating, ViewCount
|
from rating.models import Rating, ViewCount
|
||||||
from utils.models import (BaseAttributes, TJSONField, TranslatedFieldsMixin, HasTagsMixin,
|
from utils.models import (BaseAttributes, TJSONField, TranslatedFieldsMixin, HasTagsMixin,
|
||||||
ProjectBaseMixin, GalleryModelMixin, IntermediateGalleryModelMixin,
|
ProjectBaseMixin, GalleryModelMixin, IntermediateGalleryModelMixin,
|
||||||
|
|
@ -253,7 +255,12 @@ class News(GalleryModelMixin, BaseAttributes, TranslatedFieldsMixin, HasTagsMixi
|
||||||
@property
|
@property
|
||||||
def must_of_the_week(self) -> bool:
|
def must_of_the_week(self) -> bool:
|
||||||
"""Detects whether current item in carousel"""
|
"""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
|
@property
|
||||||
def publication_datetime(self):
|
def publication_datetime(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user