Reputation: 31
After reading the Wagtail documentation I came to the conclusion that there is no easy way to determine if a page was copied, and if so, from which page. Am I correct, or is there a way to determine if a page is actually a copy, and not an original.
I know that Wagtail 1.9 will have the 'before_copy_page' and 'after_copy_page' hooks. I will use this for future pages, but I still need something for all the current pages in my database.
Upvotes: 2
Views: 95
Reputation: 4138
Yes, there is no way to determine whether a page was copied based on what's in the database. However the copy function calls page.copy()
(source code), and there the event is logged:
# Log
logger.info("Page copied: \"%s\" id=%d from=%d", page_copy.title, page_copy.id, self.id)
If you keep your logs, you could parse them for entries looking like:
Page copied: "Test page" id=55 from=12
Upvotes: 0