From cdf9b05d0c91ae462bb65f518fa8f309b55b41c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Tue, 13 Aug 2024 10:06:49 +0200 Subject: [PATCH] fix Django 5.1 error, test in Django 5.1 --- .github/workflows/test.yml | 21 ++++++++++++++++++--- avatar/conf.py | 3 ++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3bffe17..1daa80a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,11 +5,26 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] - django-version: ['3.2', '4.1', '4.2'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + django-version: ['3.2', '4.1', '4.2', '5.0', '5.1.*'] exclude: - python-version: 3.11 django-version: 3.2 + + - python-version: 3.12 + django-version: 3.2 + + - python-version: 3.8 + django-version: 5.0 + + - python-version: 3.9 + django-version: 5.0 + + - python-version: 3.8 + django-version: 5.1.* + + - python-version: 3.9 + django-version: 5.1.* fail-fast: false steps: @@ -23,7 +38,7 @@ jobs: run: | pip install -r requirements.txt pip install -r tests/requirements.txt - pip install "Django~=${{ matrix.django-version }}.0" . + pip install "Django==${{ matrix.django-version }}" . - name: Run Tests run: | echo "$(python --version) / Django $(django-admin --version)" diff --git a/avatar/conf.py b/avatar/conf.py index 8859082..e9590e9 100644 --- a/avatar/conf.py +++ b/avatar/conf.py @@ -24,7 +24,8 @@ class AvatarConf(AppConf): ALLOWED_FILE_EXTS = None ALLOWED_MIMETYPES = None CACHE_TIMEOUT = 60 * 60 - STORAGE = settings.DEFAULT_FILE_STORAGE + if hasattr(settings, "DEFAULT_FILE_STORAGE"): + STORAGE = settings.DEFAULT_FILE_STORAGE STORAGE_ALIAS = "default" CLEANUP_DELETED = True AUTO_GENERATE_SIZES = (DEFAULT_SIZE,)