diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5882018..bed50db 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,19 +17,18 @@ jobs: strategy: matrix: - python-version: ["3.9"] - node-version: ["16.x"] + python-version: ["3.11"] + node-version: ["18.x"] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 - name: Install Dependencies run: | - npm ci --also=dev - python -m pip install --upgrade pip + npm ci --include=dev python -m pip install build --user - name: Build Client run: | @@ -37,7 +36,7 @@ jobs: - name: Patch templates run: | mkdir -p adminsortable2/templates/adminsortable2/edit_inline - DJANGO_VERSIONS=("4.0" "4.1" "4.2") + DJANGO_VERSIONS=("4.2" "5.0") for django_version in ${DJANGO_VERSIONS[@]}; do echo $django_version 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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 718e1a7..0d7b793 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,23 +21,26 @@ jobs: strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - node-version: ["16.x"] - django-version: ["4.0.*", "4.1.*", "4.2.*"] - exclude: # https://docs.djangoproject.com/en/4.2/faq/install/#what-python-version-can-i-use-with-django - - python-version: "3.11" - django-version: "4.0.*" + python-version: ["3.9", "3.10", "3.11", "3.12"] + node-version: ["18.x"] + django-version: ["4.2.*", "5.0.*"] + exclude: # https://docs.djangoproject.com/en/5.0/faq/install/#what-python-version-can-i-use-with-django + - python-version: "3.9" + django-version: "5.0.*" steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - name: Install Dependencies run: | - npm ci --also=dev + npm ci --include=dev python -m pip install --upgrade pip + python -m pip install --upgrade setuptools wheel python -m pip install "Django==${{ matrix.django-version }}" python -m pip install -r testapp/requirements.txt python -m playwright install @@ -48,7 +51,7 @@ jobs: - name: Patch templates run: | mkdir -p adminsortable2/templates/adminsortable2/edit_inline - DJANGO_VERSIONS=("4.0" "4.1" "4.2") + DJANGO_VERSIONS=("4.2" "5.0") for django_version in ${DJANGO_VERSIONS[@]}; do echo $django_version 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e1221e..d3d10a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Release history of [django-admin-sortable2](https://github.com/jrief/django-admin-sortable2/) +### 2.2 +- Add support for Django-5.0 +- Drop support for Python-3.12 +- Drop support for Django-4.1 and lower. + ### 2.1.11 - Upgrade all external dependencies to their latest versions. - Adopt E2E tests to use Playwright's `locator`. diff --git a/adminsortable2/__init__.py b/adminsortable2/__init__.py index cc222ab..2b9ccf1 100644 --- a/adminsortable2/__init__.py +++ b/adminsortable2/__init__.py @@ -1 +1 @@ -__version__ = '2.1.11' +__version__ = '2.2' diff --git a/setup.py b/setup.py index 67aaf50..fed06eb 100644 --- a/setup.py +++ b/setup.py @@ -21,13 +21,14 @@ def readfile(filename): 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Software Development :: Libraries :: Application Frameworks', 'Development Status :: 5 - Production/Stable', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Framework :: Django', 'Framework :: Django :: 4.0', 'Framework :: Django :: 4.1', 'Framework :: Django :: 4.2', + 'Framework :: Django :: 5.0', ] @@ -45,7 +46,7 @@ def readfile(filename): platforms=['OS Independent'], classifiers=CLASSIFIERS, install_requires=[ - 'Django>=4.0', + 'Django>=4.2', ], packages=find_packages(exclude=['client', 'testapp', 'testapp*', 'docs']), include_package_data=True, diff --git a/testapp/test_e2e_inline.py b/testapp/test_e2e_inline.py index 520161d..665fe14 100644 --- a/testapp/test_e2e_inline.py +++ b/testapp/test_e2e_inline.py @@ -1,4 +1,5 @@ import pytest +from time import sleep from playwright.sync_api import expect from testapp.models import Book @@ -69,15 +70,12 @@ def test_drag_down(adminpage, slug, direction, chapter, drag_selector): expect_fieldset_is_ordered(group_locator, direction) start_order = get_start_order(direction) expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order)) - if slug in ['book6']: - adminpage.screenshot(path=f'../workdir/screenshot-{slug}-before.png') - drag_kwargs = {'source_position': {'x': 200, 'y': 10}, 'target_position': {'x': 200, 'y': 10}} + drag_kwargs = {'source_position': {'x': 190, 'y': 9}, 'target_position': {'x': 200, 'y': 10}} drag_handle = group_locator.locator(f'{chapter}_set-0 {drag_selector}') expect(drag_handle).to_be_visible() - drag_handle.drag_to(group_locator.locator(f'{chapter}_set-4'), **drag_kwargs) - if slug in ['book6']: - adminpage.screenshot(path=f'../workdir/screenshot-{slug}-after.png') - expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order + direction * 4)) + drag_handle.drag_to(group_locator.locator(f'{chapter}_set-3'), **drag_kwargs) + sleep(0.3) # sortablejs needs some time to update the order + expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order + direction * 3)) expect(group_locator.locator(f'{chapter}_set-1 input._reorder_')).to_have_value(str(start_order)) expect_fieldset_is_ordered(group_locator, direction)