Exemplo n.º 1
0
def invalidate_frontend_cache_for_blog_index_page(sender, instance, **kwargs):
    """Invalidate the frontend cache for the parent BlogIndexPage of a BlogPost."""
    blog_post = instance
    # Recommended way to get parent page from https://github.com/wagtail/wagtail/issues/2779#issuecomment-228472829
    blog_index_page = blog_post.get_parent()
    if blog_index_page:
        purge_page_from_cache(blog_index_page)
Exemplo n.º 2
0
def purge_related(instance):
    global invalidation_map
    instance_model = instance.__class__
    if instance_model not in invalidation_map:
        return
    for related_page_model in invalidation_map[instance_model]:
        for page in related_page_model.objects.live():
            print("Purging {}".format(page))
            purge_page_from_cache(page)
Exemplo n.º 3
0
def page_published_signal_handler(instance, **kwargs):
    purge_page_from_cache(instance)
Exemplo n.º 4
0
def post_delete_signal_handler(instance, **kwargs):
    purge_page_from_cache(instance)
Exemplo n.º 5
0
def transform_party_page_changed(transform_party_page):
    """Purge parent page"""
    parent_page = transform_party_page.get_parent()
    purge_page_from_cache(parent_page)
Exemplo n.º 6
0
def post_delete_signal_handler(instance, **kwargs):
    purge_page_from_cache(instance)