Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom file storage setting: "FILE_STORAGE_BACKEND" #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KaratasFurkan
Copy link

@KaratasFurkan KaratasFurkan commented Feb 24, 2021

I will update README after you approve changes.

@@ -19,7 +19,7 @@ class SentEmail(models.Model):
to_email = models.EmailField()
from_email = models.EmailField()
subject = models.TextField()
html = models.FileField(upload_to=sent_email_upload_path)
html = models.FileField(upload_to=sent_email_upload_path, storage=get_file_storage_backend)
Copy link
Contributor

@alicertel alicertel Feb 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the storage field accept callable? I though it's expecting instance of a storage or none.

Copy link
Author

@KaratasFurkan KaratasFurkan Feb 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It accepts callable, I checked the source code and also tested in one of our projects.

It calls the callable and gets an instance of subclass of django.core.files.storage.Storage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants