mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Fire page_unpublished signal on page unpublish and delete
This commit is contained in:
parent
4320b43ede
commit
a5141d62c1
@ -18,7 +18,7 @@ from wagtail.wagtailadmin import tasks, signals
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailcore.models import Page, PageRevision
|
||||
from wagtail.wagtailcore.signals import page_published
|
||||
from wagtail.wagtailcore.signals import page_published, page_unpublished
|
||||
|
||||
|
||||
@permission_required('wagtailadmin.access_admin')
|
||||
@ -376,6 +376,7 @@ def delete(request, page_id):
|
||||
raise PermissionDenied
|
||||
|
||||
if request.POST:
|
||||
page_unpublished.send(sender=page.specific_class, instance=page)
|
||||
parent_id = page.get_parent().id
|
||||
page.delete()
|
||||
messages.success(request, _("Page '{0}' deleted.").format(page.title))
|
||||
@ -535,6 +536,7 @@ def unpublish(request, page_id):
|
||||
raise PermissionDenied
|
||||
|
||||
if request.POST:
|
||||
page_unpublished.send(sender=page.specific_class, instance=page)
|
||||
parent_id = page.get_parent().id
|
||||
page.live = False
|
||||
page.save()
|
||||
|
Loading…
Reference in New Issue
Block a user