mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Use page_unpublished signal in frontend cache invalidator
This commit is contained in:
parent
a5141d62c1
commit
f2cdd8eb42
@ -1,8 +1,7 @@
|
||||
from django.db import models
|
||||
from django.db.models.signals import post_delete
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.signals import page_published
|
||||
from wagtail.wagtailcore.signals import page_published, page_unpublished
|
||||
|
||||
from wagtail.contrib.wagtailfrontendcache.utils import purge_page_from_cache
|
||||
|
||||
@ -11,7 +10,7 @@ def page_published_signal_handler(instance, **kwargs):
|
||||
purge_page_from_cache(instance)
|
||||
|
||||
|
||||
def post_delete_signal_handler(instance, **kwargs):
|
||||
def page_unpublished_signal_handler(instance, **kwargs):
|
||||
purge_page_from_cache(instance)
|
||||
|
||||
|
||||
@ -22,4 +21,4 @@ def register_signal_handlers():
|
||||
# Loop through list and register signal handlers for each one
|
||||
for model in indexed_models:
|
||||
page_published.connect(page_published_signal_handler, sender=model)
|
||||
post_delete.connect(post_delete_signal_handler, sender=model)
|
||||
page_unpublished.connect(page_unpublished_signal_handler, sender=model)
|
||||
|
Loading…
Reference in New Issue
Block a user