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.models import ContentType
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.validators import EMPTY_VALUES
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
|
@ -287,4 +288,6 @@ class Carousel(models.Model):
|
|||
return self.content_object.establishment_type.index_name
|
||||
elif isinstance(self.content_object, News):
|
||||
return self.content_type.model
|
||||
elif self.link not in EMPTY_VALUES:
|
||||
return 'external'
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ class AwardSerializer(AwardBaseSerializer):
|
|||
|
||||
class CarouselListSerializer(serializers.ModelSerializer):
|
||||
"""Serializer for retrieving list of carousel items."""
|
||||
|
||||
model_name = serializers.CharField()
|
||||
name = serializers.CharField()
|
||||
toque_number = serializers.IntegerField()
|
||||
|
|
@ -160,6 +161,7 @@ class CarouselListSerializer(serializers.ModelSerializer):
|
|||
'vintage_year',
|
||||
'last_award',
|
||||
'slug',
|
||||
'link',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ common_urlpatterns = [
|
|||
path('awards/', AwardView.as_view(), name='awards_list'),
|
||||
path('awards/<int:pk>/', AwardRetrieveView.as_view(), name='awards_retrieve'),
|
||||
path('carousel/', CarouselListView.as_view(), name='carousel-list'),
|
||||
path('determine-location/', DetermineLocation.as_view(), name='determine-location')
|
||||
path('determine-location/', DetermineLocation.as_view(), name='determine-location')
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user