Thumbnails for images and videos #87
@ -203,8 +203,9 @@ class File(CreatedModifiedMixin, TrackChangesMixin, models.Model):
|
||||
Fall back to the source file, if no thumbnail is stored.
|
||||
Log absence of the thumbnail file instead of exploding somewhere in the templates.
|
||||
"""
|
||||
if not self.is_image and not self.is_video:
|
||||
return ''
|
||||
# We don't (yet?) have thumbnails for anything other than images and videos.
|
||||
assert self.is_image or self.is_video, f'File pk={self.pk} is neither image nor video'
|
||||
|
||||
try:
|
||||
path = self.metadata['thumbnails'][size_key]['path']
|
||||
return self.thumbnail.storage.url(path)
|
||||
|
Loading…
Reference in New Issue
Block a user