From 7a92181b5b7522c82b0b7386ec35a13996c6ef86 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Fri, 16 Aug 2024 10:37:37 +0800 Subject: [PATCH] Confirm Django 5.x support --- .github/workflows/test.yml | 2 +- CHANGES.rst | 3 +++ README.rst | 2 +- setup.py | 6 +++--- sorl/thumbnail/conf/defaults.py | 6 +----- tests/settings/default.py | 7 ++++++- tox.ini | 14 +++++++------- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8baebbbc..5b1355760 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] target: [pil, imagemagick, graphicsmagick, redis, wand, dbm] include: diff --git a/CHANGES.rst b/CHANGES.rst index e988d499d..c075c03d9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,9 @@ Changes ======= +* Add support for Django 5.0 and 5.1 +* Drop support for Django 3.2, 4.0 and 4.1 + 12.10.0 ======= * Fixed safe_filter application on various thumbnail template tags. diff --git a/README.rst b/README.rst index b06fed743..aff6cb009 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Thumbnails for Django. Features at a glance ==================== -- Support for Django 3.2, 4.0 and 4.1 following the `Django supported versions policy`_ +- Support for Django 4.2, 5.0 and 5.1 following the `Django supported versions policy`_ - Python 3 support - Storage support - Pluggable Engine support for `Pillow`_, `ImageMagick`_, `PIL`_, `Wand`_, `pgmagick`_, and `vipsthumbnail`_ diff --git a/setup.py b/setup.py index 5bbeeda67..4c2761d13 100644 --- a/setup.py +++ b/setup.py @@ -26,13 +26,13 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Multimedia :: Graphics', 'Framework :: Django', - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.0', - 'Framework :: Django :: 4.1', 'Framework :: Django :: 4.2', + 'Framework :: Django :: 5.0', + 'Framework :: Django :: 5.1', ], setup_requires=['setuptools_scm'], ) diff --git a/sorl/thumbnail/conf/defaults.py b/sorl/thumbnail/conf/defaults.py index f1eb6855b..5618622ed 100644 --- a/sorl/thumbnail/conf/defaults.py +++ b/sorl/thumbnail/conf/defaults.py @@ -1,5 +1,4 @@ from django.conf import settings -from django.core.exceptions import ImproperlyConfigured # When True ThumbnailNode.render can raise errors THUMBNAIL_DEBUG = False @@ -32,10 +31,7 @@ THUMBNAIL_VIPSHEADER = 'vipsheader' # Storage for the generated thumbnails -try: - THUMBNAIL_STORAGE = settings.STORAGES['default']['BACKEND'] -except (AttributeError, KeyError, ImproperlyConfigured): - THUMBNAIL_STORAGE = settings.DEFAULT_FILE_STORAGE +THUMBNAIL_STORAGE = settings.STORAGES['default']['BACKEND'] # Redis settings THUMBNAIL_REDIS_DB = 0 diff --git a/tests/settings/default.py b/tests/settings/default.py index 3cb46080d..2c98c5319 100644 --- a/tests/settings/default.py +++ b/tests/settings/default.py @@ -13,7 +13,12 @@ } THUMBNAIL_KVSTORE = 'tests.thumbnail_tests.kvstore.TestKVStore' THUMBNAIL_STORAGE = 'tests.thumbnail_tests.storage.TestStorage' -DEFAULT_FILE_STORAGE = 'tests.thumbnail_tests.storage.TestStorage' +STORAGES = { + "default": { + "BACKEND": "tests.thumbnail_tests.storage.TestStorage", + }, +} + ADMINS = ( ('Sorl', 'thumbnail@sorl.net'), ) diff --git a/tox.ini b/tox.ini index c6ec0f1fe..ff27ad5c4 100644 --- a/tox.ini +++ b/tox.ini @@ -4,13 +4,13 @@ python = 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [gh-actions:env] DJANGO = - 3.2: django32 - 4.0: django40 - 4.1: django41 4.2: django42 + 5.0: django50 + 5.1: django51 TARGET = pil: pil imagemagick: imagemagick @@ -24,7 +24,8 @@ TARGET = skipsdist = True envlist = py38-qa, - py{38,39,310,311}-django{32,40,41,42}-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail} + py{38,39,310,311,312}-django{42}-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail} + py{310,311,312}-django{50,51}-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail} [testenv] deps = @@ -36,10 +37,9 @@ deps = dynamodb: boto pgmagick: pgmagick wand: wand - django32: django>=3.2,<3.3 - django40: django>=4.0,<4.1 - django41: django>=4.1,<4.2 django42: django>=4.2,<4.3 + django50: django>=5.0,<5.1 + django51: django>=5.1,<5.2 setenv = PYTHONPATH = {toxinidir}:{toxinidir}