mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-12 02:50:59 +00:00
Set first_published_at on first publish
This commit is contained in:
parent
cdbae1f575
commit
0bbd8edf68
1 changed files with 5 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue