Skip to content

Commit

Permalink
add support for Django 4.2 storages
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Nov 14, 2023
1 parent d8357e7 commit 90a34d5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions import_export_celery/fields.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.core.files.storage import get_storage_class, storages
from django.db import models


def lazy_initialize_storage_class():
# If the user has specified a custom storage backend, use it.
if getattr(settings, "IMPORT_EXPORT_CELERY_STORAGE", None):
storage_class = get_storage_class(settings.IMPORT_EXPORT_CELERY_STORAGE)
return storage_class()
try:
storage_class = get_storage_class(settings.IMPORT_EXPORT_CELERY_STORAGE)
return storage_class()
except (ImportError, TypeError):
return storages[settings.IMPORT_EXPORT_CELERY_STORAGE]

return None


Expand Down

0 comments on commit 90a34d5

Please sign in to comment.