Skip to content

Commit c50291a

Browse files
committed
Add Django 4.1, update hooks
1 parent 543c047 commit c50291a

8 files changed

Lines changed: 36 additions & 34 deletions

File tree

.pre-commit-config.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
11
exclude: ".yarn/|yarn.lock"
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.1.0
4+
rev: v4.3.0
55
hooks:
66
- id: check-added-large-files
77
- id: check-merge-conflict
88
- id: end-of-file-fixer
99
- id: trailing-whitespace
10-
- repo: local
11-
hooks:
12-
- id: django-check
13-
name: django check
14-
entry: sh -c 'stat venv/bin/python && venv/bin/python manage.py check || echo "Skipped"'
15-
pass_filenames: false
16-
language: system
17-
always_run: true
1810
- repo: https://github.com/asottile/pyupgrade
19-
rev: v2.31.0
11+
rev: v2.37.3
2012
hooks:
2113
- id: pyupgrade
2214
args: [--py38-plus]
2315
- repo: https://github.com/adamchainz/django-upgrade
24-
rev: 1.4.0
16+
rev: 1.9.0
2517
hooks:
2618
- id: django-upgrade
2719
args: [--target-version, "3.2"]
@@ -31,17 +23,29 @@ repos:
3123
- id: isort
3224
args: [--profile=black, --lines-after-imports=2, --combine-as]
3325
- repo: https://github.com/psf/black
34-
rev: 22.1.0
26+
rev: 22.6.0
3527
hooks:
3628
- id: black
3729
- repo: https://github.com/pycqa/flake8
38-
rev: 4.0.1
30+
rev: 5.0.4
3931
hooks:
4032
- id: flake8
4133
args: ["--ignore=E203,E501,W503"]
34+
additional_dependencies:
35+
- flake8-bugbear
4236
- repo: https://github.com/pre-commit/mirrors-prettier
43-
rev: v2.5.1
37+
rev: v3.0.0-alpha.0
4438
hooks:
4539
- id: prettier
46-
args: [--list-different, --no-semi]
40+
args: [--list-different, --no-semi, "--trailing-comma=es5"]
4741
exclude: "^conf/|.*\\.html$"
42+
- repo: https://github.com/pre-commit/mirrors-eslint
43+
rev: v8.23.0
44+
hooks:
45+
- id: eslint
46+
additional_dependencies:
47+
- eslint@^8.23.0
48+
- eslint-config-prettier
49+
- "@babel/core"
50+
- "@babel/eslint-parser"
51+
- "@babel/preset-env"

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Change log
77

88
- Add DefaultLanguageListFilter to limit choices to settings.LANGUAGE
99
- Add default list_filter to SiteAdmin (is_active, host, default_language)
10-
- Added Python 3.10, Django 4.0 to the CI.
10+
- Added Python 3.10, Django 4.0 and 4.1 to the CI.
1111
- Raised the requirements to Python >= 3.8, Django >= 3.2.
1212

1313

feincms3_sites/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
VERSION = (0, 13, 1)
22
__version__ = ".".join(map(str, VERSION))
3-
4-
default_app_config = "feincms3_sites.apps.SitesAppConfig"

feincms3_sites/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ def get_site_model():
1515

1616
try:
1717
# make this optional as we do not want to break existing applications
18-
model_name = "feincms3_sites.site"
19-
if hasattr(settings, "FEINCMS3_SITES_SITE_MODEL"):
20-
model_name = getattr(settings, "FEINCMS3_SITES_SITE_MODEL").lower()
18+
model_name = (
19+
getattr(settings, "FEINCMS3_SITES_SITE_MODEL", None)
20+
or "feincms3_sites.site"
21+
)
2122
return django_apps.get_model(model_name, require_ready=False)
2223
except ValueError:
2324
raise ImproperlyConfigured(

tests/testapp/articles_urls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django.shortcuts import get_object_or_404
2-
from django.urls import re_path
2+
from django.urls import path
33
from feincms3.applications import page_for_app_request
44
from feincms3.shortcuts import render_detail, render_list
55

@@ -34,7 +34,7 @@ def article_detail(request, pk):
3434
app_name = "articles"
3535
ignore_app_name_mismatch = True
3636
urlpatterns = [
37-
re_path(r"^all/$", article_list_all, name="article-list-all"),
38-
re_path(r"^$", article_list, name="article-list"),
39-
re_path(r"^(?P<pk>[0-9]+)/$", article_detail, name="article-detail"),
37+
path("all/", article_list_all, name="article-list-all"),
38+
path("", article_list, name="article-list"),
39+
path("<int:pk>/", article_detail, name="article-detail"),
4040
]

tests/testapp/test_feincms3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def test_default_language_list_filter(self):
519519
self.client.login(username="admin", password="blabla")
520520
response = self.client.get("/admin/feincms3_sites/site/")
521521
# print(response, response.content.decode("utf-8"))
522-
self.assertContains(response, "<h3> By Default language </h3>", 1)
522+
self.assertContains(response, "By Default language", 1)
523523
self.assertContains(
524524
response,
525525
'<a href="?default_language=" title="No language">No language</a>'

tests/testapp/urls.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@
22
from django.contrib import admin
33
from django.http import HttpResponse, HttpResponseRedirect
44
from django.shortcuts import render
5-
from django.urls import include, re_path
5+
from django.urls import include, path, re_path
66
from testapp import views
77

88

99
pages_urlpatterns = (
1010
[
11-
re_path(
12-
r"^$", lambda request: HttpResponseRedirect("/%s/" % request.LANGUAGE_CODE)
13-
),
11+
path("", lambda request: HttpResponseRedirect("/%s/" % request.LANGUAGE_CODE)),
1412
re_path(r"^(?P<path>[-\w/]+)/$", views.page_detail, name="page"),
15-
re_path(r"^$", views.page_detail, name="root"),
13+
path("", views.page_detail, name="root"),
1614
],
1715
"pages",
1816
)
1917

2018

2119
urlpatterns = i18n_patterns(
22-
re_path(r"^i18n/$", lambda request: HttpResponse(request.LANGUAGE_CODE))
20+
path("i18n/", lambda request: HttpResponse(request.LANGUAGE_CODE))
2321
) + [
2422
re_path(r"^admin/", admin.site.urls),
25-
re_path(r"^404/$", lambda request: render(request, "404.html")),
23+
path("404/", lambda request: render(request, "404.html")),
2624
re_path(r"", include(pages_urlpatterns)),
2725
]

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{38,39,310}-dj{32,40,main}
3+
py{38,39,310}-dj{32,40,41,main}
44

55
[testenv]
66
usedevelop = true
@@ -11,4 +11,5 @@ commands =
1111
deps =
1212
dj32: Django>=3.2,<4.0
1313
dj40: Django>=4.0,<4.1
14+
dj41: Django>=4.1,<4.2
1415
djmain: https://github.com/django/django/archive/main.tar.gz

0 commit comments

Comments
 (0)