-
-
Save brunomichetti/1f90592a64c89d6513fb67a39f3a334d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# your models file | |
from django.db import models | |
from s3direct.fields import S3DirectField | |
from example_app.s3_files import get_object_key_from_url, get_presigned_url | |
class Example(models.Model): | |
image = S3DirectField(dest='example_destination') | |
@property | |
def presigned_image(self): | |
return get_presigned_url(get_object_key_from_url(self.image)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment