Skip to content

Commit 032c595

Browse files
authored
fix: Added compatibility code in aldryn_config go support setting THUMBNAIL_DEFAULT_STORAGE in django 4.2 (#1440)
1 parent 41b969d commit 032c595

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

aldryn_config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ def to_settings(self, data, settings):
4747
# If the DEFAULT_FILE_STORAGE has been set to a value known by
4848
# aldryn-django, then use that as THUMBNAIL_DEFAULT_STORAGE as well.
4949
for storage_backend in storage.SCHEMES.values():
50-
if storage_backend == settings['DEFAULT_FILE_STORAGE']:
50+
# Process before django 4.2
51+
if storage_backend == settings.get('DEFAULT_FILE_STORAGE', None):
52+
settings['THUMBNAIL_DEFAULT_STORAGE'] = storage_backend
53+
break
54+
# Process django 4.2 and after
55+
if storage_backend == settings.get('STORAGES', {}).get('default', {}).get('BACKEND', None):
5156
settings['THUMBNAIL_DEFAULT_STORAGE'] = storage_backend
5257
break
5358
return settings

0 commit comments

Comments
 (0)