-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add customizable storage backend configurable via IMPORT_EXPORT_CELER…
…YY_STORAGE
- Loading branch information
1 parent
234e93e
commit b3273d3
Showing
5 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.conf import settings | ||
from django.core.files.storage import get_storage_class | ||
from django.db import models | ||
|
||
|
||
class ImportExportFileField(models.FileField): | ||
def __init__(self, *args, **kwargs): | ||
# If the user has specified a custom storage backend, use it. | ||
if settings.IMPORT_EXPORT_CELERY_STORAGE: | ||
storage_class = get_storage_class(settings.IMPORT_EXPORT_CELERY_STORAGE) | ||
kwargs["storage"] = storage_class() | ||
|
||
super().__init__(*args, **kwargs) |
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
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