diff --git a/tuning/wagtail_hooks.py b/tuning/wagtail_hooks.py index 870f141bb9b47b647c96c1d70be5bc93bda40b05..07d7a8423ea74f77ab0f9864d90dbe3d3a607fb3 100644 --- a/tuning/wagtail_hooks.py +++ b/tuning/wagtail_hooks.py @@ -1,3 +1,5 @@ +import re + from django.conf import settings from django.contrib.postgres.lookups import Unaccent from django.db.models.functions import Lower @@ -27,7 +29,10 @@ def add_another_welcome_panel(request, panels): @hooks.register("construct_explorer_page_queryset") def show_my_profile_only(parent_page, pages, request): - return pages.order_by(Unaccent(Lower("title"))) + requested_html = re.search(r"^text/html", request.META.get("HTTP_ACCEPT")) + if not requested_html: + return pages.order_by(Unaccent(Lower("title"))) + return pages @hooks.register("insert_global_admin_css")