kopia lustrzana https://github.com/wagtail/wagtail
Add migration to populate Page.last_published_at from latest_revision_created_at
rodzic
7f34adda0a
commit
4aa404251d
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.1 on 2017-06-01 11:03
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.models import F
|
||||
|
||||
|
||||
def forwards_func(apps, schema_editor):
|
||||
Page = apps.get_model("wagtailcore", "Page")
|
||||
Page.objects.filter(has_unpublished_changes=False).update(last_published_at=F('latest_revision_created_at'))
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wagtailcore', '0035_page_last_published_at'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(forwards_func, migrations.RunPython.noop),
|
||||
]
|
||||
Ładowanie…
Reference in New Issue