You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2023/06/22 16:57:54 UTC
[airavata-django-portal] 02/07: AIRAVATA-3698 Upgrade to Wagtail 4.0
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch AIRAVATA-3698--Add-support-for-Python-3.11
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 839e35148d9bb4b8911e8f67c2aa000d580004a1
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Jun 20 18:07:33 2023 -0400
AIRAVATA-3698 Upgrade to Wagtail 4.0
---
django_airavata/wagtailapps/base/models.py | 43 ++++++++++------------
.../base/templatetags/navigation_tags.py | 3 +-
requirements.txt | 2 +-
3 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/django_airavata/wagtailapps/base/models.py b/django_airavata/wagtailapps/base/models.py
index db2360d1..b424ae76 100644
--- a/django_airavata/wagtailapps/base/models.py
+++ b/django_airavata/wagtailapps/base/models.py
@@ -10,13 +10,10 @@ from wagtail.admin.edit_handlers import (
InlinePanel,
MultiFieldPanel,
ObjectList,
- PageChooserPanel,
- StreamFieldPanel,
TabbedInterface
)
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Orderable, Page
-from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.snippets.models import register_snippet
from .blocks import BaseStreamBlock, ContainerChoiceBlock, CssStreamBlock, Nav
@@ -65,7 +62,7 @@ class NavExtra(models.Model):
('nav', Nav(max_num=1)),
])
panels = [
- StreamFieldPanel('nav'),
+ FieldPanel('nav'),
]
def __str__(self):
@@ -90,7 +87,7 @@ class CustomCss(models.Model):
default="")
panels = [
- StreamFieldPanel('css'),
+ FieldPanel('css'),
]
def __str__(self):
@@ -115,7 +112,7 @@ class FooterText(models.Model):
null=True)
panels = [
- StreamFieldPanel('footer'),
+ FieldPanel('footer'),
]
def __str__(self):
@@ -196,7 +193,7 @@ class Navbar(models.Model):
)
panels = [
- ImageChooserPanel('logo'),
+ FieldPanel('logo'),
FieldPanel('logo_redirect_link'),
FieldPanel('logo_width'),
FieldPanel('logo_height'),
@@ -344,7 +341,7 @@ class GatewayIcon(models.Model):
)
panels = [
- ImageChooserPanel('icon'),
+ FieldPanel('icon'),
FieldPanel('background_color'),
]
@@ -618,40 +615,40 @@ class HomePage(Page):
content_panels = Page.content_panels + [
MultiFieldPanel([
- ImageChooserPanel('image'),
+ FieldPanel('image'),
FieldPanel('hero_text', classname="full"),
MultiFieldPanel([
FieldPanel('hero_cta'),
- PageChooserPanel('hero_cta_link'),
+ FieldPanel('hero_cta_link'),
])
], heading="Hero section"),
- StreamFieldPanel('body'),
+ FieldPanel('body'),
MultiFieldPanel([
- ImageChooserPanel('site_logo'),
+ FieldPanel('site_logo'),
FieldPanel('features_text'),
MultiFieldPanel([
- ImageChooserPanel('feature_logo_1'),
+ FieldPanel('feature_logo_1'),
FieldPanel('feature_1_title'),
FieldPanel('feature_1_text'),
]),
MultiFieldPanel([
- ImageChooserPanel('feature_logo_2'),
+ FieldPanel('feature_logo_2'),
FieldPanel('feature_2_title'),
FieldPanel('feature_2_text'),
]),
MultiFieldPanel([
- ImageChooserPanel('feature_logo_3'),
+ FieldPanel('feature_logo_3'),
FieldPanel('feature_3_title'),
FieldPanel('feature_3_text'),
]),
MultiFieldPanel([
- ImageChooserPanel('feature_logo_4'),
+ FieldPanel('feature_logo_4'),
FieldPanel('feature_4_title'),
FieldPanel('feature_4_text'),
])
], heading="Feature section", classname="collapsible"),
FieldPanel('custom_body_message'),
- ImageChooserPanel('banner_image')
+ FieldPanel('banner_image')
]
customization_panels = [
@@ -678,7 +675,7 @@ class Row(models.Model):
)
panels = [
- StreamFieldPanel('body'),
+ FieldPanel('body'),
]
class Meta:
@@ -697,8 +694,8 @@ class BootstrapRow(Row):
)
panels = [
- StreamFieldPanel('container'),
- StreamFieldPanel('body'),
+ FieldPanel('container'),
+ FieldPanel('body'),
]
class Meta:
@@ -875,7 +872,7 @@ class CybergatewayHomePage(Page):
content_panels = Page.content_panels + [
MultiFieldPanel([
- ImageChooserPanel('site_logo'),
+ FieldPanel('site_logo'),
FieldPanel('site_link'),
FieldPanel('site_text'),
FieldPanel('site_header'),
@@ -887,8 +884,8 @@ class CybergatewayHomePage(Page):
FieldPanel('site_link_text3'),
], heading="Navbar Section"),
InlinePanel("row", label="row"),
- StreamFieldPanel('contact'),
- StreamFieldPanel('footer'),
+ FieldPanel('contact'),
+ FieldPanel('footer'),
]
customization_panels = [
diff --git a/django_airavata/wagtailapps/base/templatetags/navigation_tags.py b/django_airavata/wagtailapps/base/templatetags/navigation_tags.py
index aa4c38b1..346d3a6c 100644
--- a/django_airavata/wagtailapps/base/templatetags/navigation_tags.py
+++ b/django_airavata/wagtailapps/base/templatetags/navigation_tags.py
@@ -23,7 +23,8 @@ def get_site_root(context):
# This returns a core.Page. The main menu needs to have the site.root_page
# defined else will return an object attribute error ('str' object has no
# attribute 'get_children')
- return Site.find_for_request(context['request']).root_page
+ site = Site.find_for_request(context['request'])
+ return site.root_page if site else None
def has_menu_children(page):
diff --git a/requirements.txt b/requirements.txt
index 819a22d2..ab5011e7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,7 +9,7 @@ django-webpack-loader==0.6.0
logging-formatter-anticrlf==1.2
zipstream-new==1.1.8
-wagtail>=3.0,<3.1
+wagtail>=4.0,<4.1
wagtailfontawesome==1.2.1
wagtail-draftail-anchors==0.2.0
wagtailcodeblock==1.17.1.0