Set first_published_at on first publish

This commit is contained in:
Karl Hobley 2015-03-12 13:54:23 +00:00
parent cdbae1f575
commit 0bbd8edf68

View file

@ -1140,6 +1140,11 @@ class PageRevision(models.Model):
# If page goes live clear the approved_go_live_at of all revisions
page.revisions.update(approved_go_live_at=None)
page.expired = False # When a page is published it can't be expired
# Set first_published_at if the page is being published now
if page.live and page.first_published_at is None:
page.first_published_at = timezone.now()
page.save()
self.submitted_for_moderation = False
page.revisions.update(submitted_for_moderation=False)