Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.13'
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4

# Keep in sync with .pre-commit-config.yaml
- run: python -Im pip install --user ruff==0.5.0
- run: python -Im pip install --user ruff==0.15.14

- name: Run ruff
working-directory: ./src
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ env:
TOX_TESTENV_PASSENV: FORCE_COLOR
PIP_DISABLE_PIP_VERSION_CHECK: '1'
PIP_NO_PYTHON_VERSION_WARNING: '1'
PYTHON_LATEST: '3.11'
PYTHON_LATEST: '3.14'

jobs:
test-latest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
django: ["5.1"]
wagtail: ["6.3"]
python-version: ["3.14"]
django: ["6.0"]
wagtail: ["7.4"]
db: ["postgres"]

services:
Expand Down Expand Up @@ -71,13 +71,12 @@ jobs:
if-no-files-found: ignore
retention-days: 1

test-legacy:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
django: ["4.2"]
wagtail: ["5.2", "6.1", "6.2"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
db: ["sqlite"]
steps:
- uses: actions/checkout@v4
Expand All @@ -95,9 +94,6 @@ jobs:
run: python -Im flit build --format wheel

- name: Test
env:
TOXENV: py${{ matrix.python-version }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}-sqlite
DATABASE_URL: postgres://postgres:postgres@localhost:5432/wagtail_localize_git
run: tox --installpkg ./dist/*.whl

- name: ⬆️ Upload coverage data
Expand All @@ -113,7 +109,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- test-latest
- test-legacy
- test

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ ci:
autoupdate_schedule: 'quarterly'

default_language_version:
python: python3.11
python: python3.13

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -21,7 +21,7 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
# keep in sync with .github/workflows/ruff.yml
rev: 'v0.5.0'
rev: 'v0.15.14'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Official support for Python 3.13/3.14, Django 5.2 LTS and Django 6.0, Wagtail 7.0 LTS through 7.4 LTS ([#45](https://github.com/torchbox/wagtail-bynder/pull/45)) @nickmoreton

### Removed

- Support for Django < 5.2, Wagtail < 7.0. ([#45](https://github.com/torchbox/wagtail-bynder/pull/45)) @nickmoreton

## [0.8.1] - 2025-11-12

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ to manage their digital assets, which includes the images and documents used in
The data flow is one way: Bynder assets are always treated as the source of truth, and Wagtail uses read-only API access
to create copies of assets and keep them up-to-date.

## Compatibility

- Python 3.11, 3.12, 3.13, 3.14
- Django 5.2 LTS, 6.0
- Wagtail 7.0 LTS, 7.1, 7.2, 7.3, 7.4 LTS

## How it works

The main points of integration are Wagtail's image and document chooser views, which are patched by this app to show an
Expand Down
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Framework :: Django :: 6.0",
"Framework :: Wagtail",
"Framework :: Wagtail :: 5",
"Framework :: Wagtail :: 6",
"Framework :: Wagtail :: 7",
]

dynamic = ["version"]
requires-python = ">=3.11"
dependencies = [
"Django>=4.2",
"Wagtail>=5.2",
"Django>=5.2",
"Wagtail>=7.0",
"bynder-sdk>=1.1.5,<2.0"
]

Expand All @@ -40,7 +40,7 @@ testing = [
"dj-database-url>=2.1.0,<3.0",
"wagtail_factories>=4.1.0,<5.0",
"responses>=0.24,<1",
"coverage>=7.0,<8.0",
"coverage>=7.10,<8.0",
"freezegun>=1.1,<2",
]

Expand Down
3 changes: 1 addition & 2 deletions src/wagtail_bynder/management/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def add_arguments(self, parser):
"--minutes",
type=int,
help=_(
"The number of minutes into the past to look for asset "
"modifications."
"The number of minutes into the past to look for asset modifications."
),
)
parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion src/wagtail_bynder/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def process_downloaded_file(
"""

# Write to filesystem to avoid using memory for the same image
tmp = NamedTemporaryFile(mode="w+b", dir=settings.FILE_UPLOAD_TEMP_DIR)
tmp = NamedTemporaryFile(mode="w+b", dir=settings.FILE_UPLOAD_TEMP_DIR) # noqa: SIM115
details = self.convert_downloaded_image(file, tmp)

# The original file is now redundant and can be deleted, making
Expand Down
36 changes: 3 additions & 33 deletions src/wagtail_bynder/views/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@

from django.conf import settings
from django.utils.html import format_html
from django.views.generic import UpdateView
from wagtail import VERSION as WAGTAIL_VERSION
from wagtail.admin.modal_workflow import render_modal_workflow
from wagtail.documents import get_document_model
from wagtail.documents.views import chooser as chooser_views


if WAGTAIL_VERSION < (6, 3):
from wagtail.documents.views.documents import DeleteView
from wagtail.documents.views.documents import edit as document_edit
else:
from wagtail.documents.views.documents import DeleteView, EditView
from wagtail.documents.views.documents import DeleteView, EditView

from wagtail_bynder.exceptions import BynderAssetDownloadError

Expand All @@ -24,30 +16,8 @@
from django.http import HttpRequest, JsonResponse


if WAGTAIL_VERSION < (6, 3):

class ClassBasedDocumentEditView(UpdateView):
"""
A class-based view that mimics the behaviour of wagtail's function-based
document edit view, and can be extended with view mixins.
"""

# TODO: Use class from Wagtail once the documents app views are refactored
model = get_document_model()
pk_url_kwarg = "document_id"

def get(self, request, *args, **kwargs):
return document_edit(request, *args, **kwargs)

def post(self, request, *args, **kwargs):
return document_edit(request, *args, **kwargs)

class DocumentEditView(RedirectToBynderMixin, ClassBasedDocumentEditView):
pass
else:

class DocumentEditView(RedirectToBynderMixin, EditView):
pass
class DocumentEditView(RedirectToBynderMixin, EditView):
pass


class DocumentDeleteView(RedirectToBynderMixin, DeleteView):
Expand Down
36 changes: 3 additions & 33 deletions src/wagtail_bynder/views/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@

from django.conf import settings
from django.utils.html import format_html
from django.views.generic import UpdateView
from wagtail import VERSION as WAGTAIL_VERSION
from wagtail.admin.modal_workflow import render_modal_workflow
from wagtail.images import get_image_model
from wagtail.images.views import chooser as chooser_views


if WAGTAIL_VERSION < (6, 3):
from wagtail.images.views.images import DeleteView
from wagtail.images.views.images import edit as image_edit
else:
from wagtail.images.views.images import DeleteView, EditView
from wagtail.images.views.images import DeleteView, EditView

from wagtail_bynder.exceptions import BynderAssetDownloadError

Expand All @@ -24,30 +16,8 @@
from django.http import HttpRequest, JsonResponse


if WAGTAIL_VERSION < (6, 3):

class ClassBasedWagtailImageEditView(UpdateView):
"""
A class-based view that mimics the behaviour of wagtail's function-based
image edit view, and can be extended with view mixins.
"""

# TODO: Use class from Wagtail once the image app views are refactored
model = get_image_model()
pk_url_kwarg = "image_id"

def get(self, request, *args, **kwargs):
return image_edit(request, *args, **kwargs)

def post(self, request, *args, **kwargs):
return image_edit(request, *args, **kwargs)

class ImageEditView(RedirectToBynderMixin, ClassBasedWagtailImageEditView):
pass
else:

class ImageEditView(RedirectToBynderMixin, EditView):
pass
class ImageEditView(RedirectToBynderMixin, EditView):
pass


class ImageDeleteView(RedirectToBynderMixin, DeleteView):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_image_chooser_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_creates_image_if_asset_id_not_recognised(self):
"title": image.title,
"preview": mock.ANY,
"edit_url": reverse("wagtailimages:edit", args=[image.id]),
"default_alt_text": mock.ANY,
},
},
)
Expand Down Expand Up @@ -78,6 +79,7 @@ def test_uses_existing_image_without_updating(self, update_object_mock):
"title": image.title,
"preview": mock.ANY,
"edit_url": reverse("wagtailimages:edit", args=[image.id]),
"default_alt_text": mock.ANY,
},
},
)
Expand Down Expand Up @@ -105,6 +107,7 @@ def test_uses_existing_image_and_updates_it(self, update_object_mock):
"title": image.title,
"preview": mock.ANY,
"edit_url": reverse("wagtailimages:edit", args=[image.id]),
"default_alt_text": mock.ANY,
},
},
)
Expand Down
11 changes: 5 additions & 6 deletions tests/test_management_commands.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import datetime

from io import StringIO
from typing import Type
from unittest import mock

from django.core.management import call_command
Expand Down Expand Up @@ -45,7 +44,7 @@ class SyncCommandTestsMixin:
"""

command_name: str = ""
command_class: Type = None
command_class: type = None
uses_media_info_for_individual_assets: bool = False

@classmethod
Expand Down Expand Up @@ -222,8 +221,8 @@ class RefreshCommandTestsMixin:
"""

command_name: str = ""
command_class: Type
factory_class: Type
command_class: type
factory_class: type

@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -407,7 +406,7 @@ class SyncCommandErrorHandlingMixin:
"""

command_name: str = ""
factory_class: Type
factory_class: type

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -472,7 +471,7 @@ class RefreshCommandErrorHandlingMixin:
"""

command_name: str = ""
factory_class: Type
factory_class: type

@classmethod
def setUpTestData(cls):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_wagtail_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def test_admin_base_template_override_is_working(self):
html = response.content.decode("utf-8")

self.assertIn(
f'<script src="{ settings.STATIC_URL }wagtailadmin/js/chooser-modal-handler-factory.js">',
f'<script src="{settings.STATIC_URL}wagtailadmin/js/chooser-modal-handler-factory.js">',
html,
)
self.assertIn(
f'<script src="{ settings.STATIC_URL }bynder/js/compactview-v4.0.0.js">',
f'<script src="{settings.STATIC_URL}bynder/js/compactview-v4.0.0.js">',
html,
)
Loading
Loading