Skip to content

Commit

Permalink
Merge pull request #12 from sown/wagtail-6-0
Browse files Browse the repository at this point in the history
Upgrade to Wagtail 6.0
  • Loading branch information
trickeydan authored Feb 8, 2024
2 parents bd73308 + e23382e commit 5224717
Show file tree
Hide file tree
Showing 10 changed files with 506 additions and 569 deletions.
77 changes: 0 additions & 77 deletions kmicms/core/models.py

This file was deleted.

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
16 changes: 9 additions & 7 deletions kmicms/core/templates/core/blocks/elements/card.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{% load wagtailcore_tags wagtailimages_tags %}
{% image value.image width-728 height-240 as tmp_image %}
<div class="card">
<img src="{{ tmp_image.url }}" class="card-img-top img-fluid p-3" alt="Image">
<div class="card-body">
<h5 class="card-title">{{ value.title }}</h5>
<p class="card-text">{{ value.text|richtext}}</p>
{% for cta in value.cta_list %}
{% include_block cta %}
{% endfor %}
<div class="m-auto">
<img src="{{ tmp_image.url }}" class="card-img-top img-fluid p-3" alt="Image">
<div class="card-body">
<h5 class="card-title">{{ value.title }}</h5>
<p class="card-text">{{ value.text|richtext}}</p>
{% for cta in value.cta_list %}
{% include_block cta %}
{% endfor %}
</div>
</div>
</div>
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
Loading

0 comments on commit 5224717

Please sign in to comment.