diff options
Diffstat (limited to 'pyblackbird_cc/resources/models.py')
-rw-r--r-- | pyblackbird_cc/resources/models.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pyblackbird_cc/resources/models.py b/pyblackbird_cc/resources/models.py index 7bbf244..3dfad06 100644 --- a/pyblackbird_cc/resources/models.py +++ b/pyblackbird_cc/resources/models.py @@ -1,6 +1,9 @@ +from django.conf import settings from django.db import models from django.urls import reverse +from .s3 import get_presigned_obj_url + CURRICULUM_CHOICES = [ ("No curriculum", "No curriculum"), ("English", "English"), @@ -115,8 +118,11 @@ class Resource(models.Model): def get_absolute_url(self): return reverse("resources:resource_detail", kwargs={"resource_id": self.pk}) - def thumbnail_urls(self): - ri = _extract_metadata_from_resource(self) + def thumbnail_urls(self) -> list[str]: + return [ + get_presigned_obj_url(settings.AWS_STORAGE_BUCKET_NAME, f"thumbnails/{f}") + for f in self.thumbnail_filenames + ] class ResourceType(models.Model): |