Wagtail query for scheduled pages
Wagtail has "scheduled" pages that are not yet visible on the site. I think the interface is not ideal as you need to click the Publish
button after setting a publication date on the Settings
tab. I'm not sure how exactly the data models work, but the actual publication is handled by a management command and putting the publication date into the future after the post was published doesn't seem to unpublish it.
I wanted to get a list of pages that were scheduled for publication, the query below might not handle all edge cases but shows how I got what I needed.
Edit: The wagtail Page model has a property approved_schedule which does a lookup on related revisions. It could probably be adapted to build a Page queryset, but I didn't look further into it.
MyPageModel.objects.filter(go_live_at__isnull=False).not_live()
0 comments
Reply