Skip to content

Commit

Permalink
fix: Added compatibility code in aldryn_config go support setting THU…
Browse files Browse the repository at this point in the history
…MBNAIL_DEFAULT_STORAGE in django 4.2 (#1440)
  • Loading branch information
kinkerl authored Nov 17, 2023
1 parent 41b969d commit 032c595
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aldryn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ def to_settings(self, data, settings):
# If the DEFAULT_FILE_STORAGE has been set to a value known by
# aldryn-django, then use that as THUMBNAIL_DEFAULT_STORAGE as well.
for storage_backend in storage.SCHEMES.values():
if storage_backend == settings['DEFAULT_FILE_STORAGE']:
# Process before django 4.2
if storage_backend == settings.get('DEFAULT_FILE_STORAGE', None):
settings['THUMBNAIL_DEFAULT_STORAGE'] = storage_backend
break
# Process django 4.2 and after
if storage_backend == settings.get('STORAGES', {}).get('default', {}).get('BACKEND', None):
settings['THUMBNAIL_DEFAULT_STORAGE'] = storage_backend
break
return settings

0 comments on commit 032c595

Please sign in to comment.