Carousel link
This commit is contained in:
parent
dcea8b2a69
commit
4f67c295d1
|
|
@ -5,6 +5,7 @@ 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.contenttypes.models import ContentType
|
||||||
from django.contrib.postgres.fields import JSONField
|
from django.contrib.postgres.fields import JSONField
|
||||||
|
from django.core.validators import EMPTY_VALUES
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
@ -287,4 +288,6 @@ class Carousel(models.Model):
|
||||||
return self.content_object.establishment_type.index_name
|
return self.content_object.establishment_type.index_name
|
||||||
elif isinstance(self.content_object, News):
|
elif isinstance(self.content_object, News):
|
||||||
return self.content_type.model
|
return self.content_type.model
|
||||||
|
elif self.link not in EMPTY_VALUES:
|
||||||
|
return 'external'
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ class AwardSerializer(AwardBaseSerializer):
|
||||||
|
|
||||||
class CarouselListSerializer(serializers.ModelSerializer):
|
class CarouselListSerializer(serializers.ModelSerializer):
|
||||||
"""Serializer for retrieving list of carousel items."""
|
"""Serializer for retrieving list of carousel items."""
|
||||||
|
|
||||||
model_name = serializers.CharField()
|
model_name = serializers.CharField()
|
||||||
name = serializers.CharField()
|
name = serializers.CharField()
|
||||||
toque_number = serializers.IntegerField()
|
toque_number = serializers.IntegerField()
|
||||||
|
|
@ -160,6 +161,7 @@ class CarouselListSerializer(serializers.ModelSerializer):
|
||||||
'vintage_year',
|
'vintage_year',
|
||||||
'last_award',
|
'last_award',
|
||||||
'slug',
|
'slug',
|
||||||
|
'link',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user