Skip to content

Commit 387d5d1

Browse files
authored
Merge pull request #391 from jrief/django-5-support
Django 5 support
2 parents 8cac5c3 + 1b7fabd commit 387d5d1

File tree

6 files changed

+31
-25
lines changed

6 files changed

+31
-25
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,26 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
python-version: ["3.9"]
21-
node-version: ["16.x"]
20+
python-version: ["3.11"]
21+
node-version: ["18.x"]
2222

2323
steps:
2424
- uses: actions/checkout@v3
2525
- name: Use Node.js ${{ matrix.node-version }}
2626
uses: actions/setup-node@v3
2727
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v3
28+
uses: actions/setup-python@v5
2929
- name: Install Dependencies
3030
run: |
31-
npm ci --also=dev
32-
python -m pip install --upgrade pip
31+
npm ci --include=dev
3332
python -m pip install build --user
3433
- name: Build Client
3534
run: |
3635
npm run build
3736
- name: Patch templates
3837
run: |
3938
mkdir -p adminsortable2/templates/adminsortable2/edit_inline
40-
DJANGO_VERSIONS=("4.0" "4.1" "4.2")
39+
DJANGO_VERSIONS=("4.2" "5.0")
4140
for django_version in ${DJANGO_VERSIONS[@]}; do
4241
echo $django_version
4342
curl --silent --output adminsortable2/templates/adminsortable2/edit_inline/stacked-django-$django_version.html https://raw.githubusercontent.com/django/django/stable/$django_version.x/django/contrib/admin/templates/admin/edit_inline/stacked.html

.github/workflows/tests.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,26 @@ jobs:
2121

2222
strategy:
2323
matrix:
24-
python-version: ["3.8", "3.9", "3.10", "3.11"]
25-
node-version: ["16.x"]
26-
django-version: ["4.0.*", "4.1.*", "4.2.*"]
27-
exclude: # https://docs.djangoproject.com/en/4.2/faq/install/#what-python-version-can-i-use-with-django
28-
- python-version: "3.11"
29-
django-version: "4.0.*"
24+
python-version: ["3.9", "3.10", "3.11", "3.12"]
25+
node-version: ["18.x"]
26+
django-version: ["4.2.*", "5.0.*"]
27+
exclude: # https://docs.djangoproject.com/en/5.0/faq/install/#what-python-version-can-i-use-with-django
28+
- python-version: "3.9"
29+
django-version: "5.0.*"
3030

3131
steps:
3232
- uses: actions/checkout@v3
3333
- name: Use Node.js ${{ matrix.node-version }}
3434
uses: actions/setup-node@v3
3535
- name: Set up Python ${{ matrix.python-version }}
36-
uses: actions/setup-python@v3
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: ${{ matrix.python-version }}
3739
- name: Install Dependencies
3840
run: |
39-
npm ci --also=dev
41+
npm ci --include=dev
4042
python -m pip install --upgrade pip
43+
python -m pip install --upgrade setuptools wheel
4144
python -m pip install "Django==${{ matrix.django-version }}"
4245
python -m pip install -r testapp/requirements.txt
4346
python -m playwright install
@@ -48,7 +51,7 @@ jobs:
4851
- name: Patch templates
4952
run: |
5053
mkdir -p adminsortable2/templates/adminsortable2/edit_inline
51-
DJANGO_VERSIONS=("4.0" "4.1" "4.2")
54+
DJANGO_VERSIONS=("4.2" "5.0")
5255
for django_version in ${DJANGO_VERSIONS[@]}; do
5356
echo $django_version
5457
curl --silent --output adminsortable2/templates/adminsortable2/edit_inline/stacked-django-$django_version.html https://raw.githubusercontent.com/django/django/stable/$django_version.x/django/contrib/admin/templates/admin/edit_inline/stacked.html

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Release history of [django-admin-sortable2](https://github.com/jrief/django-admin-sortable2/)
44

5+
### 2.2
6+
- Add support for Django-5.0
7+
- Drop support for Python-3.12
8+
- Drop support for Django-4.1 and lower.
9+
510
### 2.1.11
611
- Upgrade all external dependencies to their latest versions.
712
- Adopt E2E tests to use Playwright's `locator`.

adminsortable2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.1.11'
1+
__version__ = '2.2'

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ def readfile(filename):
2121
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
2222
'Topic :: Software Development :: Libraries :: Application Frameworks',
2323
'Development Status :: 5 - Production/Stable',
24-
'Programming Language :: Python :: 3.8',
2524
'Programming Language :: Python :: 3.9',
2625
'Programming Language :: Python :: 3.10',
26+
'Programming Language :: Python :: 3.11',
2727
'Framework :: Django',
2828
'Framework :: Django :: 4.0',
2929
'Framework :: Django :: 4.1',
3030
'Framework :: Django :: 4.2',
31+
'Framework :: Django :: 5.0',
3132
]
3233

3334

@@ -45,7 +46,7 @@ def readfile(filename):
4546
platforms=['OS Independent'],
4647
classifiers=CLASSIFIERS,
4748
install_requires=[
48-
'Django>=4.0',
49+
'Django>=4.2',
4950
],
5051
packages=find_packages(exclude=['client', 'testapp', 'testapp*', 'docs']),
5152
include_package_data=True,

testapp/test_e2e_inline.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from time import sleep
23
from playwright.sync_api import expect
34

45
from testapp.models import Book
@@ -69,15 +70,12 @@ def test_drag_down(adminpage, slug, direction, chapter, drag_selector):
6970
expect_fieldset_is_ordered(group_locator, direction)
7071
start_order = get_start_order(direction)
7172
expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order))
72-
if slug in ['book6']:
73-
adminpage.screenshot(path=f'../workdir/screenshot-{slug}-before.png')
74-
drag_kwargs = {'source_position': {'x': 200, 'y': 10}, 'target_position': {'x': 200, 'y': 10}}
73+
drag_kwargs = {'source_position': {'x': 190, 'y': 9}, 'target_position': {'x': 200, 'y': 10}}
7574
drag_handle = group_locator.locator(f'{chapter}_set-0 {drag_selector}')
7675
expect(drag_handle).to_be_visible()
77-
drag_handle.drag_to(group_locator.locator(f'{chapter}_set-4'), **drag_kwargs)
78-
if slug in ['book6']:
79-
adminpage.screenshot(path=f'../workdir/screenshot-{slug}-after.png')
80-
expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order + direction * 4))
76+
drag_handle.drag_to(group_locator.locator(f'{chapter}_set-3'), **drag_kwargs)
77+
sleep(0.3) # sortablejs needs some time to update the order
78+
expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order + direction * 3))
8179
expect(group_locator.locator(f'{chapter}_set-1 input._reorder_')).to_have_value(str(start_order))
8280
expect_fieldset_is_ordered(group_locator, direction)
8381

0 commit comments

Comments
 (0)