Skip to content

Commit

Permalink
Add support for Django 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
stephrdev committed Jul 8, 2024
1 parent 38a162a commit f181678
Show file tree
Hide file tree
Showing 11 changed files with 782 additions and 774 deletions.
4 changes: 2 additions & 2 deletions .python-version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
3.11.9
3.10.14
3.9.16
3.8.15
3.7.16
3.6.15
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ clean:
poetry run make -C docs clean

correct:
poetry run isort static_templates tests
poetry run black -q static_templates tests
poetry run isort ultimatethumb tests
poetry run black -q ultimatethumb tests

docs:
poetry run make -C docs html
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Next, add the `django-ultimatethumb` urls to your ``urls.py``
urlpatterns += patterns(
'',
url(
re_path(
r'^{0}/'.format(settings.ULTIMATETHUMB_URL.strip('/')),
include('ultimatethumb.urls')
),
Expand Down
1,520 changes: 763 additions & 757 deletions poetry.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-ultimatethumb"
version = "1.2.0"
version = "1.3.0"
description = "Generate thumbnails of anything."
authors = [
"Stephan Jaekel <steph@rdev.info>"
Expand All @@ -23,8 +23,7 @@ packages = [{ include = "ultimatethumb" }]
include = ["LICENSE.rst"]

[tool.poetry.dependencies]
python = ">=3.6,<4"
importlib-metadata = {version = "*", python = "<3.8"}
python = ">=3.8,<4"

Django = ">=2.2"
Pillow = ">=8.3"
Expand All @@ -39,6 +38,7 @@ pytest-flake8 = ">=1.0"
pytest-isort = ">=2.0"
pytest-black = ">=0.3"
factory-boy = ">=3.2"
flake8 = "<5"
coverage = {version = ">=5.5", extras = ["toml"]}

[tool.poetry.extras]
Expand All @@ -59,7 +59,6 @@ DJANGO_SETTINGS_MODULE = "tests.settings"
[tool.black]
line-length = 96
skip-string-normalization = true
skip-numeric-underscore-normalization = true
include = "\\.pyi?$"
exclude = "/(\\.git|\\.tox|build|dist)/"

Expand Down
1 change: 1 addition & 0 deletions tests/test_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@pytest.mark.django_db
class TestThumbnail:
@pytest.fixture(autouse=True)
def setup(self):
cache.clear()

Expand Down
2 changes: 2 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_get_cache_key():


class TestGetThumbName:
@pytest.fixture(autouse=True)
def setup(self):
cache.clear()

Expand Down Expand Up @@ -58,6 +59,7 @@ def test_call_cache_set(self, set_mock, has_mock):


class TestGetThumbData:
@pytest.fixture(autouse=True)
def setup(self):
cache.clear()

Expand Down
1 change: 1 addition & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@pytest.mark.django_db
class TestThumbnailView:
@pytest.fixture(autouse=True)
def setup(self):
self.image = ImageModelFactory.create()
self.thumbnail = Thumbnail(self.image.file.path, {'size': [50, 50]})
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[tox]
isolated_build = true
envlist = py{37,38,39}-django{22,30,31,32}
envlist = py{38,39,310,311}-django{22,32,42}

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[testenv]
setenv = PYTHONPATH={toxinidir}
deps =
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
django42: Django>=4.2,<4.3
allowlist_externals =
poetry
sh
Expand Down
6 changes: 3 additions & 3 deletions ultimatethumb/urls.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from django.conf.urls import url
from django.urls import re_path

from .views import ThumbnailView

urlpatterns = [
url(
re_path(
r'^(?P<name>[\w\-]{40}/[\w\-\_\.]+\.\w{3,4})$',
ThumbnailView.as_view(),
name='thumbnail',
),
# Prepared to support other factors, currently only 2x.
url(
re_path(
r'^(?P<factor>[2])x/(?P<name>[\w\-]{40}/[\w\-\_\.]+\.\w{3,4})$',
ThumbnailView.as_view(),
name='thumbnail-factor',
Expand Down
1 change: 0 additions & 1 deletion ultimatethumb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def render_thumbnail(self, thumbnail, factor):
if not was_modified_since(
self.request.META.get('HTTP_IF_MODIFIED_SINCE'),
thumbnail_stat.st_mtime,
thumbnail_stat.st_size,
):
return HttpResponseNotModified()

Expand Down

0 comments on commit f181678

Please sign in to comment.