【发布时间】:2019-03-29 02:29:01
【问题描述】:
我正在尝试以编程方式创建一个PostPage 对象。这个类继承自 wagtail 的 Page 模型:
post = PostPage.objects.create(
title='Dummy',
intro='This is just for testing dummy',
body='Lorem ipsum dolor...',
first_published_at=datetime.strptime(f'2019-01-01', '%Y-%m-%d')
)
但是,我收到以下错误:
ValidationError: {'path': ['This field cannot be blank.'], 'depth': ['This field cannot be null.']}
我需要创建一些虚拟的Page 对象,所以我想知道如何解决这个问题。
【问题讨论】: