diff --git a/elections2021/models.py b/elections2021/models.py index 990d730e99d0ce48a52b37f31a99ffefc64e684d..cb5c5b012055481198053bf4351b796f2a89bfea 100644 --- a/elections2021/models.py +++ b/elections2021/models.py @@ -1593,9 +1593,7 @@ class BenefitBlock(blocks.StructBlock): template = "elections2021/_benefit_block.html" -class Elections2021ProgramPointPage( - SubpageMixin, MetadataPageMixin, Page, index.Indexed -): +class Elections2021ProgramPointPage(SubpageMixin, MetadataPageMixin, Page): ### FIELDS annotation = RichTextField( diff --git a/majak/settings/base.py b/majak/settings/base.py index f40850162fdbf825f32e0ecd5f304aad9b05d0d3..963e6153bcc458a2e14df8aa135a0cddf1cc2030 100644 --- a/majak/settings/base.py +++ b/majak/settings/base.py @@ -77,6 +77,7 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.humanize", + "django.contrib.postgres", ] # AUTHENTICATION diff --git a/tuning/wagtail_hooks.py b/tuning/wagtail_hooks.py index c33d9bb0b17631fa6fd62d5c1b30179203fc7a55..8f148360e530199cb96504c58740c8673542d46d 100644 --- a/tuning/wagtail_hooks.py +++ b/tuning/wagtail_hooks.py @@ -1,3 +1,5 @@ +from django.contrib.postgres.lookups import Unaccent +from django.db.models.functions import Lower from django.utils.safestring import mark_safe from wagtail.core import hooks @@ -5,7 +7,7 @@ from wagtail.core import hooks class HelpPanel: order = 1000 - def render(self): + def render_html(self, parent_context): return mark_safe( """ <section class="nice-padding"> @@ -20,3 +22,8 @@ class HelpPanel: @hooks.register("construct_homepage_panels") def add_another_welcome_panel(request, panels): panels.append(HelpPanel()) + + +@hooks.register("construct_explorer_page_queryset") +def show_my_profile_only(parent_page, pages, request): + return pages.order_by(Unaccent(Lower("title")))