|
|
@ -205,7 +205,8 @@ class PodcastPlaylistListSerializer(serializers.ModelSerializer): |
|
|
fields = ['id', 'title', 'slug', 'thumbnail', 'slogan', 'view_count', 'total_time_formatted', 'episodes_count', 'order', 'created_at'] |
|
|
fields = ['id', 'title', 'slug', 'thumbnail', 'slogan', 'view_count', 'total_time_formatted', 'episodes_count', 'order', 'created_at'] |
|
|
|
|
|
|
|
|
def get_thumbnail(self, obj): |
|
|
def get_thumbnail(self, obj): |
|
|
return get_thumbs(obj.thumbnail, self.context.get('request')) |
|
|
|
|
|
|
|
|
thumb = getattr(obj, 'effective_thumbnail', obj.thumbnail) |
|
|
|
|
|
return get_thumbs(thumb, self.context.get('request')) |
|
|
|
|
|
|
|
|
def get_total_time_formatted(self, obj): |
|
|
def get_total_time_formatted(self, obj): |
|
|
return format_duration(obj.total_time) |
|
|
return format_duration(obj.total_time) |
|
|
@ -231,7 +232,8 @@ class PodcastPlaylistDetailSerializer(serializers.ModelSerializer): |
|
|
'categories', 'created_at', 'user_rate', 'average_rate', 'bookmark', 'podcasts'] |
|
|
'categories', 'created_at', 'user_rate', 'average_rate', 'bookmark', 'podcasts'] |
|
|
|
|
|
|
|
|
def get_thumbnail(self, obj): |
|
|
def get_thumbnail(self, obj): |
|
|
return get_thumbs(obj.thumbnail, self.context.get('request')) |
|
|
|
|
|
|
|
|
thumb = getattr(obj, 'effective_thumbnail', obj.thumbnail) |
|
|
|
|
|
return get_thumbs(thumb, self.context.get('request')) |
|
|
|
|
|
|
|
|
def get_total_time_formatted(self, obj): |
|
|
def get_total_time_formatted(self, obj): |
|
|
return format_duration(obj.total_time) |
|
|
return format_duration(obj.total_time) |
|
|
|