From 8e0d20bcb50aa3e2982ca8ae831ecdd8b6073fea Mon Sep 17 00:00:00 2001 From: zerolab Date: Tue, 28 Jan 2025 17:54:34 +0000 Subject: [PATCH] Use the Wagtail-preview aware cache tag --- wagtailio/navigation/models.py | 4 +- .../patterns/includes/menu_footer.html | 64 +++++++------- .../patterns/includes/menu_main.html | 86 +++++++++---------- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/wagtailio/navigation/models.py b/wagtailio/navigation/models.py index 1df36a582..80905c8ab 100644 --- a/wagtailio/navigation/models.py +++ b/wagtailio/navigation/models.py @@ -97,8 +97,8 @@ def save(self, **kwargs): fragment_key_seeds = ["primarynav", "footernav"] keys = [ # The fragment cache varies on: - # the current site pk, whether used in preview, or in the pattern library - make_template_fragment_key(key, vary_on=[self.site.pk, False, False]) + # the current site pk, whether it is used in the pattern library + make_template_fragment_key(key, vary_on=[self.site.pk, False]) for key in fragment_key_seeds ] cache.delete_many(keys) diff --git a/wagtailio/project_styleguide/templates/patterns/includes/menu_footer.html b/wagtailio/project_styleguide/templates/patterns/includes/menu_footer.html index c72d8683c..f922a7aa5 100644 --- a/wagtailio/project_styleguide/templates/patterns/includes/menu_footer.html +++ b/wagtailio/project_styleguide/templates/patterns/includes/menu_footer.html @@ -1,38 +1,38 @@ -{% load wagtailcore_tags cache %} +{% load wagtailcore_tags wagtail_cache %} {% if footer_navigation %} {% wagtail_site as current_site %} - {% cache 900 footernav current_site.pk request.is_preview is_pattern_library %} - - {% endcache %} + + + + {% endwith %} + {% endfor %} + + +{% endcache %} {% endif %} diff --git a/wagtailio/project_styleguide/templates/patterns/includes/menu_main.html b/wagtailio/project_styleguide/templates/patterns/includes/menu_main.html index 8d7ab422e..cf1b92a1b 100644 --- a/wagtailio/project_styleguide/templates/patterns/includes/menu_main.html +++ b/wagtailio/project_styleguide/templates/patterns/includes/menu_main.html @@ -1,45 +1,45 @@ -{% load wagtailcore_tags cache %} +{% load wagtailcore_tags wagtail_cache %} {% wagtail_site as current_site %} -{% cache 900 primarynav current_site.pk request.is_preview is_pattern_library %} - +{% wagtailcache 900 primarynav current_site.pk is_pattern_library %} + {% endcache %}