New status string to indicate [live + scheduled]

pull/4157/merge
Patrick Woods 2017-11-21 18:16:24 -05:00 zatwierdzone przez Matt Westcott
rodzic 52e76095d9
commit ad440ff060
2 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -1454,6 +1454,8 @@ class TestPageEdit(TestCase, WagtailTestUtils):
"A page scheduled for future publishing should have has_unpublished_changes=True"
)
self.assertEqual(child_page_new.status_string, "scheduled")
def test_edit_post_publish_now_an_already_scheduled_unpublished_page(self):
# Unpublish the page
self.child_page.live = False
@ -1477,9 +1479,11 @@ class TestPageEdit(TestCase, WagtailTestUtils):
child_page_new = SimplePage.objects.get(id=self.child_page.id)
# The page should not be live anymore
# The page should not be live
self.assertFalse(child_page_new.live)
self.assertEqual(child_page_new.status_string, "scheduled")
# Instead a revision with approved_go_live_at should now exist
self.assertTrue(
PageRevision.objects.filter(page=child_page_new).exclude(approved_go_live_at__isnull=True).exists()
@ -1537,6 +1541,8 @@ class TestPageEdit(TestCase, WagtailTestUtils):
# The page should still be live
self.assertTrue(child_page_new.live)
self.assertEqual(child_page_new.status_string, "live + scheduled")
# Instead a revision with approved_go_live_at should now exist
self.assertTrue(
PageRevision.objects.filter(page=child_page_new).exclude(approved_go_live_at__isnull=True).exists()

Wyświetl plik

@ -988,7 +988,9 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
else:
return _("draft")
else:
if self.has_unpublished_changes:
if self.approved_schedule:
return _("live + scheduled")
elif self.has_unpublished_changes:
return _("live + draft")
else:
return _("live")