Last active
October 9, 2018 08:42
-
-
Save abirafdirp/abceb1efed936ab1c8db93e63a6ceed7 to your computer and use it in GitHub Desktop.
S3PrivateFileField
This file contains hidden or 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
from django.db import models | |
class S3PrivateFileField(models.FileField): | |
""" | |
Using this for local storage is also viable since it's only an | |
instance attribute, which is not used in local storage. | |
""" | |
def __init__(self, verbose_name=None, name=None, upload_to='', | |
storage=None, **kwargs): | |
super().__init__( | |
verbose_name=verbose_name, name=name, upload_to=upload_to, | |
storage=storage, **kwargs | |
) | |
self.storage.default_acl = 'private' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment