1
Fork 0

[DUBS-521] Wagtail 3 and Django 4 compatibility (#25)

* Update imports for Django 4 compatibility DUBS-521

* use globalThis as global object in js file DUBS-521

* Update package requirements to include Wagtail 3 DUBS-521

* Match requirements in pyproject.toml and setup.py files DUBS-521
This commit is contained in:
Tidiane Dia 2022-05-26 16:03:49 +01:00 committed by GitHub
parent 0b45457dd7
commit a068e4e9ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View file

@ -8,8 +8,8 @@ readme = "README.md"
license = "BSD-3-Clause" license = "BSD-3-Clause"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.6" python = ">=3.6"
wagtail = "^2.5" wagtail = ">=2.5.0 <4.0"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
pytest = "^3.0" pytest = "^3.0"

View file

@ -38,7 +38,7 @@ setup(
"templates/wagtail_draftail_snippet/*.html", "templates/wagtail_draftail_snippet/*.html",
] ]
}, },
install_requires=["wagtail==2.*,>=2.5.0"], install_requires=["wagtail>=2.5.0,<4.0"],
extras_require={ extras_require={
"dev": [ "dev": [
"black==19.*,>=19.10.0", "black==19.*,>=19.10.0",

View file

@ -9,6 +9,7 @@
const TooltipEntity = window.draftail.TooltipEntity; const TooltipEntity = window.draftail.TooltipEntity;
const global = globalThis;
const $ = global.jQuery; const $ = global.jQuery;
const MUTABILITY = {}; const MUTABILITY = {};

View file

@ -1,5 +1,4 @@
from django.urls import path from django.urls import path
from django.conf.urls import url
from wagtail.snippets.views import chooser from wagtail.snippets.views import chooser
@ -9,13 +8,13 @@ from .views import choose_snippet_link_model, choose_snippet_embed_model
app_name = "wagtaildraftailsnippet" app_name = "wagtaildraftailsnippet"
urlpatterns = [ urlpatterns = [
url( path(
r"^choose-link-model/$", "choose-link-model/",
choose_snippet_link_model, choose_snippet_link_model,
name="choose-snippet-link-model", name="choose-snippet-link-model",
), ),
url( path(
r"^choose-embed-model/$", "choose-embed-model/",
choose_snippet_embed_model, choose_snippet_embed_model,
name="choose-snippet-embed-model", name="choose-snippet-embed-model",
), ),

View file

@ -1,7 +1,7 @@
from django.conf.urls import include, url from django.urls import include, path
from django.urls import reverse from django.urls import reverse
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.translation import ugettext from django.utils.translation import gettext
from wagtail.admin.rich_text.editors.draftail import features as draftail_features from wagtail.admin.rich_text.editors.draftail import features as draftail_features
from wagtail.core import hooks from wagtail.core import hooks
@ -26,7 +26,7 @@ def register_snippet_link_feature(features):
"draftail", "draftail",
feature_name, feature_name,
draftail_features.EntityFeature( draftail_features.EntityFeature(
{"type": type_, "icon": "snippet", "description": ugettext("Snippet Link")}, {"type": type_, "icon": "snippet", "description": gettext("Snippet Link")},
js=[ js=[
"wagtailsnippets/js/snippet-chooser-modal.js", "wagtailsnippets/js/snippet-chooser-modal.js",
"wagtail_draftail_snippet/js/snippet-model-chooser-modal.js", "wagtail_draftail_snippet/js/snippet-model-chooser-modal.js",
@ -51,7 +51,7 @@ def register_snippet_embed_feature(features):
"draftail", "draftail",
feature_name, feature_name,
draftail_features.EntityFeature( draftail_features.EntityFeature(
{"type": type_, "icon": "code", "description": ugettext("Snippet Embed")}, {"type": type_, "icon": "code", "description": gettext("Snippet Embed")},
js=[ js=[
"wagtailsnippets/js/snippet-chooser-modal.js", "wagtailsnippets/js/snippet-chooser-modal.js",
"wagtail_draftail_snippet/js/snippet-model-chooser-modal.js", "wagtail_draftail_snippet/js/snippet-model-chooser-modal.js",
@ -81,4 +81,4 @@ def editor_js():
@hooks.register("register_admin_urls") @hooks.register("register_admin_urls")
def register_admin_urls(): def register_admin_urls():
return [url(r"^snippets/", include(urls, namespace="wagtaildraftailsnippet"))] return [path("snippets/", include(urls, namespace="wagtaildraftailsnippet"))]