如何以编程方式对 ATFolder 子类的子类重新排序?
我有 Plone 产品,它使用自定义文件夹类型来包含一组自定义内容对象。 文件夹类型是通过子类化 BaseFolder 创建的,它有一个包含几个文本字段的架构。 目前,当自定义对象添加到自定义文件夹时,对象会按其 ID 按字母顺序排序。 如何覆盖此行为并允许我的用户手动对自定义文件夹进行排序(例如通过“内容”视图)?
I have Plone product that uses a custom folder type for containing a set of custom content objects. The folder type was created by subclassing BaseFolder and it has a schema with a couple of text fields. Currently, when custom objects are added to the custom folder, the objects are sorted alphabetically by their id. How can I override this behavior and allow my users to sort the custom folders manually, say through the "Contents" view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最快的解决方案:从 ATFolder 而不是 BaseFolder 子类。 这为您提供了所有“正常”重新排序和其他常见的克隆文件夹功能(我怀疑您也想要)。
如果您想更具选择性,请查看 Products/ATContentTypes/content/base.py:ATCTOrderedFolder 和 OrderedBaseFolder。
Quickest solution: subclass from ATFolder instead of BaseFolder. That gives you all the "normal" reordering and other commmon plone folder capabilities (which I suspect you also want).
If you want to be more selective, look into Products/ATContentTypes/content/base.py: ATCTOrderedFolder and OrderedBaseFolder.