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 5 support #391

Merged
merged 3 commits into from
May 15, 2024
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
11 changes: 5 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,26 @@ 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: |
npm run build
- 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
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion adminsortable2/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.11'
__version__ = '2.2'
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]


Expand All @@ -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,
Expand Down
12 changes: 5 additions & 7 deletions testapp/test_e2e_inline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from time import sleep
from playwright.sync_api import expect

from testapp.models import Book
Expand Down Expand Up @@ -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)

Expand Down
Loading