migration - Plone 体 5 中 Plone 体敏捷性内容类型的内容迁移

标签 migration plone plone-5.x

我在 Employee.xml 中定义了一个敏捷内容类型作为模型。

<model xmlns="http://namespaces.plone.org/supermodel/schema"
   xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
   xmlns:i18n="http://xml.zope.org/namespaces/i18n"
   i18n:domain="plone">
  <schema>
    <field name="fullname" type="zope.schema.TextLine">
      <description />
      <required>True</required>
      <title>Firstname and Surname</title>
    </field>
    <field name="position" type="zope.schema.TextLine">
      <description />
      <required>True</required>
      <title>Position</title>
    </field>
  </schema>
</model>

非常简单。该类在 content.py 中定义。

class Employee(Item):
    """Convenience subclass for ``Employee`` portal type
    """

我的数据库中有一些 Employee 实例。

现在我想向我的内容类型添加新功能。

class Employee(Item):
    """Convenience subclass for ``Employee`` portal type
    """

    def Title(self):
        return self.fullname

现在我可以在folder_contents View 中看到员工的全名。但仅适用于修改后添加的实例。 “旧”内容似乎需要迁移。 我的问题:如何? 这些文档没有帮助。 ( https://docs.plone.org/develop/plone/persistency/migrations.html )

最佳答案

较旧的实例尚未重新索引,因此基于目录的所有内容(集合、导航、搜索、文件夹内容等)无法识别其新的 Title 属性。

只需重新索引您的portal_catalog 就可以了。

关于migration - Plone 体 5 中 Plone 体敏捷性内容类型的内容迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43805284/

相关文章:

asp.net-mvc - 无法更新数据库以匹配当前模型,因为存在挂起的更改并且禁用了自动迁移

permissions - 如何防止登录用户访问 Plone-5.X 中的 @@historyview?

configuration - .NET Core 配置 - System.Net connectionManagement/maxconnections?

ruby-on-rails - Rails 3 长文本迁移

indexing - 标题和描述未使用 Collective.dexteritytextindexer 建立索引

testing - 如何使用 IContextAwareDefaultFactory 测试内容类型

plone - 使用 PloneFormGen 自定义脚本适配器以编程方式执行内容规则

javascript - 在 Plone 5 的分面 View 中使用模型模式

plone - 移动 Plone 页面导致 "a different document with value already exists in the index"错误

javascript - 从 1.8.3 到 1.9.1 的 jQuery 迁移在一行中停止工作,我不知道为什么