must of the week mark

This commit is contained in:
a.gorbunov 2020-02-07 10:40:30 +00:00
parent 0eb6a73e09
commit 5b6db0f974
2 changed files with 8 additions and 3 deletions

View File

@ -255,6 +255,7 @@ class EstablishmentRUDSerializer(model_serializers.EstablishmentBaseSerializer):
'status',
'status_display',
'last_review',
'must_of_the_week',
]
def to_representation(self, instance):

View File

@ -518,6 +518,7 @@ def default_menu_bool_array():
class PhoneModelMixin:
"""Mixin for PhoneNumberField."""
@cached_property
def country_calling_code(self):
"""Return phone code from PhonеNumberField."""
@ -546,10 +547,13 @@ class CarouselMixin:
"""Detects whether current item in carousel"""
from main.models import Carousel
if hasattr(self, 'pk') and hasattr(self, 'country'):
if hasattr(self, 'pk') and (hasattr(self, 'country') or hasattr(self, 'country_id')):
kwargs = {
'content_type': ContentType.objects.get_for_model(self),
'object_id': self.pk,
'country': self.country,
'country': getattr(self, 'country', getattr(self, 'country_id', None)),
}
return Carousel.objects.filter(**kwargs).exists()
return Carousel.objects.filter(**kwargs).exists()
return False