From da513289e52260adcf000d6fe273a40a62406383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Wed, 22 May 2024 09:31:56 +0200 Subject: [PATCH 1/2] fix for Django 5.1 --- categories/models.py | 3 ++- categories/settings.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/categories/models.py b/categories/models.py index f1c23fa5..f024960d 100644 --- a/categories/models.py +++ b/categories/models.py @@ -14,7 +14,6 @@ from .settings import ( RELATION_MODELS, RELATIONS, - THUMBNAIL_STORAGE, THUMBNAIL_STORAGE_ALIAS, THUMBNAIL_UPLOAD_PATH, ) @@ -27,6 +26,8 @@ except ImportError: from django.core.files.storage import get_storage_class + from .settings import THUMBNAIL_STORAGE + STORAGE = get_storage_class(THUMBNAIL_STORAGE)() diff --git a/categories/settings.py b/categories/settings.py index fd76ca4e..d0afb827 100644 --- a/categories/settings.py +++ b/categories/settings.py @@ -11,7 +11,6 @@ "M2M_REGISTRY": {}, "FK_REGISTRY": {}, "THUMBNAIL_UPLOAD_PATH": "uploads/categories/thumbnails", - "THUMBNAIL_STORAGE": settings.DEFAULT_FILE_STORAGE, "THUMBNAIL_STORAGE_ALIAS": "default", "JAVASCRIPT_URL": getattr(settings, "STATIC_URL", settings.MEDIA_URL) + "js/", "SLUG_TRANSLITERATOR": "", @@ -19,6 +18,9 @@ "RELATION_MODELS": [], } +if hasattr(settings, "DEFAULT_FILE_STORAGE"): + DEFAULT_SETTINGS["THUMBNAIL_STORAGE"] = settings.DEFAULT_FILE_STORAGE + DEFAULT_SETTINGS.update(getattr(settings, "CATEGORIES_SETTINGS", {})) if DEFAULT_SETTINGS["SLUG_TRANSLITERATOR"]: From 3f1a5d0defc442dffaeeb1324188bf91b9e9941f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Wed, 22 May 2024 09:32:49 +0200 Subject: [PATCH 2/2] test in Django 5.1 pre-release --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8c9d2554..f3440727 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ envlist = py{37,38,39,310}-django{32} py{38,39,310}-django{40} py{38,39,310,311}-django{41} - py{310,311,312}-django{42,50} + py{310,311,312}-django{42,50,51} coverage-report [gh-actions] @@ -32,6 +32,7 @@ deps= django41: Django>=4.1,<4.2 django42: Django>=4.2,<5.0 django50: Django>=5.0,<5.1 + django51: git+https://github.com/django/django@main # TODO: update when Django 5.1 is released coverage[toml] pillow ipdb