Skip to content

Commit

Permalink
Refs #22713 Provide wagtail 4.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Gökhan Karaboğa authored and crgwbr committed Feb 14, 2023
1 parent 16dd81c commit 1172648
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 72 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings

.idea
sandbox/db.sqlite3

# End of https://www.gitignore.io/api/osx,linux,python,sublimetext
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ translations:
cd src/wagtail_nav_menus && \
django-admin makemessages -a && \
django-admin compilemessages

makemigrations:
docker-compose run web python sandbox/manage.py makemigrations
4 changes: 2 additions & 2 deletions sandbox/sandbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"taggit",
"modelcluster",
"sandbox",
"wagtail.core",
"wagtail",
"wagtail.admin",
"wagtail.documents",
"wagtail.snippets",
Expand All @@ -49,7 +49,7 @@
]
if wagtail.VERSION[0] == 2 and wagtail.VERSION[1] < 9:
MIDDLEWARE += [
"wagtail.core.middleware.SiteMiddleware",
"wagtail.middleware.SiteMiddleware",
]
MIDDLEWARE += [
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
Expand Down
2 changes: 1 addition & 1 deletion sandbox/sandbox/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from django.conf import settings
from django.conf.urls.static import static
from django.urls import include, re_path
from wagtail.core import urls as wagtail_urls
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.search.signal_handlers import (
register_signal_handlers as wagtailsearch_register_signal_handlers,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
packages = find_packages("src")

install_requires = [
"wagtail>=2.7,<4.1",
"wagtail>=3.0,<4.2",
]
extras_require = {
"development": ["flake8>=3.3.0", "tox>=2.7.0", "ipdb"],
Expand Down
2 changes: 1 addition & 1 deletion src/wagtail_nav_menus/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
("django_url", "wagtail_nav_menus.models", "DjangoURLBlock"),
("relative_url", "wagtail_nav_menus.models", "RelativeURLBlock"),
("image", "wagtail.images.blocks", "ImageChooserBlock"),
("html", "wagtail.core.blocks", "RawHTMLBlock"),
("html", "wagtail.blocks", "RawHTMLBlock"),
]

WAGTAIL_NAV_MENU_CHOICES_DEFAULT = [
Expand Down
10 changes: 5 additions & 5 deletions src/wagtail_nav_menus/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import unicode_literals

from django.db import migrations, models
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


Expand Down Expand Up @@ -37,13 +37,13 @@ class Migration(migrations.Migration):
),
(
"menu",
wagtail.core.fields.StreamField(
wagtail.fields.StreamField(
(
(
"heading",
wagtail.core.blocks.CharBlock(classname="full title"),
wagtail.blocks.CharBlock(classname="full title"),
),
("paragraph", wagtail.core.blocks.RichTextBlock()),
("paragraph", wagtail.blocks.RichTextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
)
),
Expand Down
80 changes: 40 additions & 40 deletions src/wagtail_nav_menus/migrations/0002_auto_20190911_1745.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
import wagtail_nav_menus.models

Expand Down Expand Up @@ -58,105 +58,105 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="navmenu",
name="menu",
field=wagtail.core.fields.StreamField(
field=wagtail.fields.StreamField(
[
(
"nav_category",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
("title", wagtail.core.blocks.CharBlock()),
("title", wagtail.blocks.CharBlock()),
(
"sub_nav",
wagtail.core.blocks.StreamBlock(
wagtail.blocks.StreamBlock(
[
(
"page_link",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(
wagtail.blocks.CharBlock(
required=False
),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(
wagtail.blocks.BooleanBlock(
required=False
),
),
(
"page",
wagtail.core.blocks.PageChooserBlock(),
wagtail.blocks.PageChooserBlock(),
),
]
),
),
(
"external_link",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(
wagtail.blocks.CharBlock(
required=False
),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(
wagtail.blocks.BooleanBlock(
required=False
),
),
(
"link",
wagtail.core.blocks.URLBlock(),
wagtail.blocks.URLBlock(),
),
]
),
),
(
"django_url",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(
wagtail.blocks.CharBlock(
required=False
),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(
wagtail.blocks.BooleanBlock(
required=False
),
),
(
"url_name",
wagtail.core.blocks.CharBlock(),
wagtail.blocks.CharBlock(),
),
]
),
),
(
"relative_url",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(
wagtail.blocks.CharBlock(
required=False
),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(
wagtail.blocks.BooleanBlock(
required=False
),
),
(
"link",
wagtail.core.blocks.RegexBlock(
wagtail.blocks.RegexBlock(
error_mesage={
"invalid": "Not a relative URL"
},
Expand All @@ -172,7 +172,7 @@ class Migration(migrations.Migration):
),
(
"html",
wagtail.core.blocks.RawHTMLBlock(),
wagtail.blocks.RawHTMLBlock(),
),
]
),
Expand All @@ -182,67 +182,67 @@ class Migration(migrations.Migration):
),
(
"page_link",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(required=False),
wagtail.blocks.CharBlock(required=False),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(required=False),
wagtail.blocks.BooleanBlock(required=False),
),
("page", wagtail.core.blocks.PageChooserBlock()),
("page", wagtail.blocks.PageChooserBlock()),
]
),
),
(
"external_link",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(required=False),
wagtail.blocks.CharBlock(required=False),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(required=False),
wagtail.blocks.BooleanBlock(required=False),
),
("link", wagtail.core.blocks.URLBlock()),
("link", wagtail.blocks.URLBlock()),
]
),
),
(
"django_url",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(required=False),
wagtail.blocks.CharBlock(required=False),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(required=False),
wagtail.blocks.BooleanBlock(required=False),
),
("url_name", wagtail.core.blocks.CharBlock()),
("url_name", wagtail.blocks.CharBlock()),
]
),
),
(
"relative_url",
wagtail.core.blocks.StructBlock(
wagtail.blocks.StructBlock(
[
(
"override_title",
wagtail.core.blocks.CharBlock(required=False),
wagtail.blocks.CharBlock(required=False),
),
(
"open_in_new_tab",
wagtail.core.blocks.BooleanBlock(required=False),
wagtail.blocks.BooleanBlock(required=False),
),
(
"link",
wagtail.core.blocks.RegexBlock(
wagtail.blocks.RegexBlock(
error_mesage={"invalid": "Not a relative URL"},
regex="^(?!www\\.|(?:http|ftp)s?://|[A-Za-z]:\\\\|//).*",
),
Expand All @@ -251,7 +251,7 @@ class Migration(migrations.Migration):
),
),
("image", wagtail.images.blocks.ImageChooserBlock()),
("html", wagtail.core.blocks.RawHTMLBlock()),
("html", wagtail.blocks.RawHTMLBlock()),
]
),
),
Expand Down
21 changes: 21 additions & 0 deletions src/wagtail_nav_menus/migrations/0004_alter_navmenu_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.1.5 on 2023-01-31 15:10

from django.db import migrations
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('wagtail_nav_menus', '0003_auto_20191111_1655'),
]

operations = [
migrations.AlterField(
model_name='navmenu',
name='menu',
field=wagtail.fields.StreamField([('nav_category', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('sub_nav', wagtail.blocks.StreamBlock([('page_link', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('page', wagtail.blocks.PageChooserBlock())])), ('external_link', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('link', wagtail.blocks.URLBlock())])), ('django_url', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('url_name', wagtail.blocks.CharBlock())])), ('relative_url', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('link', wagtail.blocks.RegexBlock(error_mesage={'invalid': 'Not a relative URL'}, regex='^(?!www\\.|(?:http|ftp)s?://|[A-Za-z]:\\\\|//).*'))])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('html', wagtail.blocks.RawHTMLBlock())]))])), ('page_link', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('page', wagtail.blocks.PageChooserBlock())])), ('external_link', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('link', wagtail.blocks.URLBlock())])), ('django_url', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('url_name', wagtail.blocks.CharBlock())])), ('relative_url', wagtail.blocks.StructBlock([('override_title', wagtail.blocks.CharBlock(required=False)), ('open_in_new_tab', wagtail.blocks.BooleanBlock(required=False)), ('link', wagtail.blocks.RegexBlock(error_mesage={'invalid': 'Not a relative URL'}, regex='^(?!www\\.|(?:http|ftp)s?://|[A-Za-z]:\\\\|//).*'))])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('html', wagtail.blocks.RawHTMLBlock())], use_json_field=True),
),
]
Loading

0 comments on commit 1172648

Please sign in to comment.