Django CMS:: Deserialization Error :: page has no field named 'path'

Django CMS:: Deserialization Error :: page has no field named 'path'

我有一个使用 Django CMS 的 Django 应用程序。我使用 CMS 在应用程序中构建了自定义插件、页面、用户等。我想将 CMS 数据从我的应用程序导出到同一应用程序的另一个没有任何 cms 相关数据的实例。

我正在使用以下命令:

python manage.py dumpdata cms djangocms_column djangocms_file djangocms_googlemap djangocms_link djangocms_picture djangocms_style  djangocms_text_ckeditor djangocms_video > cms_export.json --indent=2

我将该文件复制到另一个应用程序实例并尝试使用以下命令加载它:

python manage.py loaddata cms_export.json

我收到以下错误:

django.core.serializers.base.DeserializationError: Problem installing fixture '/cms_export.json': Page has no field named 'path'

cms_export.json 片段:

    [{
  "model": "cms.usersettings",
  "pk": 1,
  "fields": {
    "user": 2,
    "language": "en",
    "clipboard": 1
  }
},
{
  "model": "cms.usersettings",
  "pk": 2,
  "fields": {
    "user": 1,
    "language": "en",
    "clipboard": 7
  }
},
{
  "model": "cms.page",
  "pk": 4,
  "fields": {
    "path": "0004",
    "depth": 1,
    "numchild": 0,
    "created_by": "script",
    "changed_by": "xxxx",
    "parent": null,
    "creation_date": "2018-01-27T18:51:08.122Z",
    "changed_date": "2018-02-04T19:48:21.804Z",
    "publication_date": "2018-01-27T18:52:43.340Z",
    "publication_end_date": null,
    "in_navigation": true,
    "soft_root": false,
    "reverse_id": null,
    "navigation_extenders": null,
    "template": "base.html",
    "site": 1,
    "login_required": false,
    "limit_visibility_in_menu": null,
    "is_home": true,
    "application_urls": "",
    "application_namespace": null,
    "publisher_is_draft": true,
    "publisher_public": 5,
    "languages": "en",
    "revision_id": 0,
    "xframe_options": 0,
    "placeholders": [
      3,
      9
    ]
  }
},
{
  "model": "cms.page",
  "pk": 5,
  "fields": {
    "path": "0005",
    "depth": 1,
    "numchild": 0,
    "created_by": "admin",
    "changed_by": "xxxx",
    "parent": null,
    "creation_date": "2018-01-27T18:52:43.345Z",
    "changed_date": "2018-02-04T19:48:21.792Z",
    "publication_date": "2018-01-27T18:52:43.340Z",
    "publication_end_date": null,
    "in_navigation": true,
    "soft_root": false,
    "reverse_id": null,
    "navigation_extenders": null,
    "template": "base.html",
    "site": 1,
    "login_required": false,
    "limit_visibility_in_menu": null,
    "is_home": true,
    "application_urls": "",
    "application_namespace": null,
    "publisher_is_draft": false,
    "publisher_public": 4,
    "languages": "en",
    "revision_id": 0,
    "xframe_options": 0,
    "placeholders": [
      4,
      8
    ]
  }
},
{
  "model": "cms.page",
  "pk": 10,
  "fields": {
    "path": "0007",
    "depth": 1,
    "numchild": 0,
    "created_by": "script",
    "changed_by": "xxxx",
    "parent": null,
    "creation_date": "2018-01-31T19:56:22.494Z",
    "changed_date": "2018-02-04T18:49:06.843Z",
    "publication_date": "2018-01-31T19:57:23.405Z",
    "publication_end_date": null,
    "in_navigation": true,
    "soft_root": false,
    "reverse_id": null,
    "navigation_extenders": null,
    "template": "base.html",
    "site": 1,
    "login_required": false,
    "limit_visibility_in_menu": null,
    "is_home": false,
    "application_urls": null,
    "application_namespace": null,
    "publisher_is_draft": true,
    "publisher_public": 11,
    "languages": "en",
    "revision_id": 0,
    "xframe_options": 0,
    "placeholders": [
      26
    ]
  }
},]

提前致谢。

您的错误是声称 cms.page 没有 'path' 字段,这可能意味着该模型可能没有您期望的架构。

我可以回答这个问题。感谢@tinwhiskers

Divio 团队几天前推出了稳定的 3.5 版 django-cms。

我的旧实例使用的是 3.4.5,而我尝试加载灯具的新实例使用的是 3.5.0

因此,我遇到了相互冲突的模型。

在我的新实例上降级到 3.4.5 并且能够成功安装 fixtures。

希望这对遇到同样问题的人有所帮助!