Skip to content

Commit

Permalink
Update to Wagtail 6
Browse files Browse the repository at this point in the history
  • Loading branch information
trickeydan committed Feb 8, 2024
1 parent 05e2790 commit 028ebff
Show file tree
Hide file tree
Showing 9 changed files with 499 additions and 487 deletions.
4 changes: 2 additions & 2 deletions kmicms/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class SiteSettings(ClusterableModel, BaseSiteSetting):
help_text="The initial year of copyright for the site.",
)

main_menu = StreamField(MainMenuBlock(), blank=True, use_json_field=True)
footer_menu = StreamField(FooterMenuBlock(), blank=True, use_json_field=True)
main_menu = StreamField(MainMenuBlock(), blank=True)
footer_menu = StreamField(FooterMenuBlock(), blank=True)

class Meta:
verbose_name = "Site Settings"
Expand Down
4 changes: 2 additions & 2 deletions kmicms/core/models/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class SiteSettings(ClusterableModel, BaseSiteSetting):
help_text="The initial year of copyright for the site.",
)

main_menu = StreamField(MainMenuBlock(), blank=True, use_json_field=True)
footer_menu = StreamField(FooterMenuBlock(), blank=True, use_json_field=True)
main_menu = StreamField(MainMenuBlock(), blank=True)
footer_menu = StreamField(FooterMenuBlock(), blank=True)

class Meta:
verbose_name = "Site Settings"
Expand Down
5 changes: 0 additions & 5 deletions kmicms/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.http import HttpRequest
from django.template.response import TemplateResponse
from wagtail.models import Page
from wagtail.search.models import Query


def search(request: HttpRequest) -> TemplateResponse:
Expand All @@ -12,10 +11,6 @@ def search(request: HttpRequest) -> TemplateResponse:
# Search
if search_query:
search_results = Page.objects.live().search(search_query)
query = Query.get(search_query)

# Record hit
query.add_hit()
else:
search_results = Page.objects.none()

Expand Down
8 changes: 0 additions & 8 deletions kmicms/kmicms/settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os
import platform

from django.contrib.messages import constants as messages
from django.core.exceptions import ImproperlyConfigured
from pkg_resources import parse_version

#
# Environment setup
Expand All @@ -13,12 +11,6 @@
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)

# Validate Python version
if parse_version(platform.python_version()) < parse_version("3.10.0"): # pragma: nocover
raise RuntimeError(
f"KMI-CMS requires Python 3.10 or higher (current: Python {platform.python_version()})",
)

#
# Configuration import
#
Expand Down
2 changes: 1 addition & 1 deletion kmicms/pages/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class HomePage(Page):
parent_page_types = ["wagtailcore.Page"]
subpage_types = ["standard_page.StandardPage", "contact.ContactFormPage", "infra.NetboxInfrastructurePage"]

content = StreamField(BodyBlock(), use_json_field=True)
content = StreamField(BodyBlock())

content_panels = [
TitleFieldPanel("title"),
Expand Down
2 changes: 1 addition & 1 deletion kmicms/pages/infra/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class NetboxInfrastructurePage(RoutablePageMixin, Page):
max_count = 1
subpage_types = []

content = StreamField(StoryBlock(), use_json_field=True)
content = StreamField(StoryBlock())
device_description = RichTextField()
vm_description = RichTextField()

Expand Down
2 changes: 1 addition & 1 deletion kmicms/pages/standard_page/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class StandardPage(Page):
content = StreamField(StoryBlock(), use_json_field=True)
content = StreamField(StoryBlock())
show_breadcrumbs = models.BooleanField(help_text="Show breadcrumbs at top of page?", default=True)
show_title = models.BooleanField(help_text="Show page title at top of page?", default=True)

Expand Down
957 changes: 491 additions & 466 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
wagtail = "^5.2.2" # LTS
wagtail = "^6.0" # LTS
django = "^4.2" # LTS

# Django Apps
Expand Down

0 comments on commit 028ebff

Please sign in to comment.