mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-20 05:36:03 -05:00
feat: playlist optimizations (#1216)
This commit is contained in:
@@ -1312,7 +1312,7 @@ class Playlist(models.Model):
|
||||
|
||||
@property
|
||||
def media_count(self):
|
||||
return self.media.count()
|
||||
return self.media.filter(listable=True).count()
|
||||
|
||||
def get_absolute_url(self, api=False):
|
||||
if api:
|
||||
@@ -1359,7 +1359,7 @@ class Playlist(models.Model):
|
||||
|
||||
@property
|
||||
def thumbnail_url(self):
|
||||
pm = self.playlistmedia_set.first()
|
||||
pm = self.playlistmedia_set.filter(media__listable=True).first()
|
||||
if pm and pm.media.thumbnail:
|
||||
return helpers.url_from_path(pm.media.thumbnail.path)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user