Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 4.x Support #176

Merged
merged 9 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[run]
branch = True
include = example/*
include =
example/*
image_cropping/*
omit =
*/migrations/*
*/conf/*
Expand Down
24 changes: 12 additions & 12 deletions example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-e .
easy_thumbnails==2.7.0
WebTest==2.0.35
django-webtest==1.9.7
coverage==5.3
isort==5.5.3
pytest==6.0.2
pytest-cov==2.10.1
pytest-django==3.10.0
easy_thumbnails==2.8.1
WebTest==3.0.0
django-webtest==1.9.9
coverage==5.5
isort==5.10.1
pytest==6.2.5
pytest-cov==3.0.0
pytest-django==4.5.2
pytest-env==0.6.2
pytest-factoryboy==2.0.3
pytest-html==2.1.1
pytest-isort==1.2.0
pytest-black==0.3.11
pytest-factoryboy==2.1.0
pytest-html==3.1.1
pytest-isort==2.0.0
pytest-black==0.3.12
4 changes: 2 additions & 2 deletions example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from easy_thumbnails.conf import settings as thumbnail_settings

import django.template

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

DEBUG = True
Expand All @@ -18,6 +16,8 @@
}

TIME_ZONE = "Europe/Berlin"
# Keep pre Django 4.0 behaviour after upgrading
USE_TZ = False
LANGUAGE_CODE = "en-us"

SITE_ID = 1
Expand Down
17 changes: 9 additions & 8 deletions example/urls.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
from example import views

from django.conf import settings
from django.conf.urls import static, url
from django.conf.urls import static
from django.contrib import admin
from django.urls import re_path

urlpatterns = [
url(r"^$", views.thumbnail_options, name="thumbnail_options"),
url(
re_path(r"^$", views.thumbnail_options, name="thumbnail_options"),
jwedel marked this conversation as resolved.
Show resolved Hide resolved
re_path(
r"^show_foreignkey_thumbnail/$",
views.thumbnail_foreign_key,
name="thumbnail_foreign_key",
),
url(
re_path(
r"^show_foreignkey_thumbnail/(?P<instance_id>\d+)/$",
views.thumbnail_foreign_key,
name="thumbnail_foreign_key",
),
url(
re_path(
r"^modelform_example/(?P<image_id>\d+)/$",
views.modelform_example,
name="modelform_example",
),
url(r"^modelform_example/$", views.modelform_example, name="modelform_example"),
url(
re_path(r"^modelform_example/$", views.modelform_example, name="modelform_example"),
re_path(
r"^show_thumbnail/(?P<image_id>\d+)/$",
views.show_thumbnail,
name="show_thumbnail",
),
url(r"^admin/", admin.site.urls),
re_path(r"^admin/", admin.site.urls),
]

urlpatterns += static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
2 changes: 1 addition & 1 deletion image_cropping/backends/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import abc

from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
jwedel marked this conversation as resolved.
Show resolved Hide resolved

from .. import widgets

Expand Down
2 changes: 1 addition & 1 deletion image_cropping/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from .config import settings

Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[pytest]
DJANGO_SETTINGS_MODULE=example.settings
addopts = --durations=10 --isort --black --durations=10 --reuse-db --cov-config .coveragerc --html test_results.html
testpaths = example/tests
jwedel marked this conversation as resolved.
Show resolved Hide resolved
testpaths = tests
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ envlist =
py{36,37,38,39}-django30
py{36,37,38,39}-django31
py{36,37,38,39}-django32
py{38,39}-django40

[gh-actions]
python =
Expand All @@ -19,16 +20,15 @@ python =

[testenv]
commands =
pytest example --create-db --cache-clear --cov-append
; # TODO: fixme it is empty and thus failing
; coverage report
coverage run -m pytest example --create-db --cache-clear --cov-append
coverage report
setenv =
DJANGO_SETTINGS_MODULE=example.settings
PYTHONPATH={toxinidir}
deps =
pillow==6.2.2
-r{toxinidir}/example/requirements.txt
django22: Django>=2.2,<3.0
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<4
django40: Django>=4.0,<4.1