mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-26 23:54:00 +00:00
make unpublish() a method on PageQuerySet as suggested by @kaedroho in https://github.com/torchbox/wagtail/pull/566#commitcomment-8037361
This commit is contained in:
parent
e49f64aea3
commit
223dcbc14d
2 changed files with 7 additions and 1 deletions
|
|
@ -631,7 +631,7 @@ def copy(request, page_id):
|
|||
|
||||
# Unpublish copied pages if we need to
|
||||
if not publish_copies:
|
||||
new_page.get_descendants(inclusive=True).update(live=False, has_unpublished_changes=True)
|
||||
new_page.get_descendants(inclusive=True).unpublish()
|
||||
|
||||
# Assign user of this request as the owner of all the new pages
|
||||
new_page.get_descendants(inclusive=True).update(owner=request.user)
|
||||
|
|
|
|||
|
|
@ -198,3 +198,9 @@ class PageQuerySet(MP_NodeQuerySet):
|
|||
"""
|
||||
search_backend = get_search_backend(backend)
|
||||
return search_backend.search(query_string, self, fields=None)
|
||||
|
||||
def unpublish(self):
|
||||
"""
|
||||
This unpublishes all pages in the queryset
|
||||
"""
|
||||
self.update(live=False, has_unpublished_changes=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue