Add slug to carousel serializer
This commit is contained in:
parent
b1e09d806a
commit
beb031d0b6
|
|
@ -337,6 +337,11 @@ class Carousel(models.Model):
|
|||
if hasattr(self.content_object, 'image_url'):
|
||||
return self.content_object.image_url
|
||||
|
||||
@property
|
||||
def slug(self):
|
||||
if hasattr(self.content_object, 'slug'):
|
||||
return self.content_object.slug
|
||||
|
||||
@property
|
||||
def model_name(self):
|
||||
return self.content_object.__class__.__name__
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ class CarouselListSerializer(serializers.ModelSerializer):
|
|||
'image',
|
||||
'vintage_year',
|
||||
'last_award',
|
||||
'slug',
|
||||
]
|
||||
|
||||
def get_last_award(self, obj):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user