Skip to content

Commit

Permalink
Merge pull request #3406 from uktrade/develop
Browse files Browse the repository at this point in the history
UAT / PROD Release
  • Loading branch information
sebs-code authored Sep 18, 2024
2 parents ad98ff1 + 7537630 commit 2e08826
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
50 changes: 50 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ class Meta:
layout_panels = [FieldPanel('template')]
settings_panels = [FieldPanel('slug')] + Page.settings_panels

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('country_tags'),
index.SearchField('sector_tags'),
index.SearchField('type_of_export_tags'),
]

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
field = self._meta.get_field('template')
Expand Down Expand Up @@ -536,6 +542,12 @@ class TaggedPage(Page):
),
]

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('country_tags'),
index.SearchField('sector_tags'),
index.SearchField('type_of_export_tags'),
]

@cached_classmethod
def get_edit_handler(cls): # noqa
panels = [
Expand Down Expand Up @@ -2239,6 +2251,15 @@ class Meta:

review_reminder_sent = models.DateTimeField(blank=True, null=True)

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('page_title'),
index.SearchField('page_subheading'),
index.SearchField('page_teaser'),
index.SearchField('page_body'),
index.SearchField('cta_title'),
index.SearchField('cta_teaser'),
]

def get_parent_page(self):
current_page = self.specific
parent_page = self.get_parent().specific
Expand Down Expand Up @@ -2449,6 +2470,12 @@ class Meta:
blank=True,
)

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('page_title'),
index.SearchField('page_teaser'),
index.SearchField('page_body'),
]


class SupportTopicLandingPage(SeoMixin, cms_panels.SupportTopicLandingPanels, Page):
template = 'domestic/contact/export-support/topic-landing.html'
Expand Down Expand Up @@ -2494,6 +2521,12 @@ class Meta:
blank=True,
)

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('page_title'),
index.SearchField('page_description'),
index.SearchField('page_body'),
]


class GetInTouchPage(SeoMixin, cms_panels.GetInTouchPanels, Page):
template = 'domestic/contact/export-support/get-in-touch.html'
Expand Down Expand Up @@ -2530,6 +2563,12 @@ class Meta:
blank=True,
)

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('page_title'),
index.SearchField('page_teaser'),
index.SearchField('page_body'),
]


class TaskBasedCategoryPage(cms_panels.TaskBasedCategoryPage, Page):
template = 'domestic/contact/export-support/task-based-category-page.html'
Expand All @@ -2549,6 +2588,11 @@ class Meta:
null=True,
)

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('page_title'),
index.SearchField('page_intro'),
]


class TaskBasedSubCategoryPage(cms_panels.TaskBasedSubCategoryPage, Page):
template = 'domestic/contact/export-support/task-based-sub-category-page.html'
Expand Down Expand Up @@ -2582,6 +2626,12 @@ class Meta:
blank=True,
)

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('page_title'),
index.SearchField('page_intro'),
index.SearchField('page_body'),
]


@register_setting(icon='link-external')
class ShareSettings(BaseSiteSetting):
Expand Down
8 changes: 8 additions & 0 deletions domestic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from wagtail.images import get_image_model_string
from wagtail.images.blocks import ImageChooserBlock
from wagtail.models import Page
from wagtail.search import index
from wagtail.snippets.blocks import SnippetChooserBlock

from core import blocks as core_blocks, cache_keys, helpers, mixins, service_urls
Expand Down Expand Up @@ -225,6 +226,13 @@ def get_absolute_url(self):
path = self.get_url()
return base_url + path if path else ''

search_fields = Page.search_fields + [ # Inherit search_fields from Page
index.SearchField('country_tags'),
index.SearchField('sector_tags'),
index.SearchField('region_tags'),
index.SearchField('type_of_export_tags'),
]


class SocialLinksPageMixin(Page):
"""Abstract base class that adds social sharing links to the context
Expand Down

0 comments on commit 2e08826

Please sign in to comment.