如何从 child 插件中获取标题以便在 django-cms 管理员中使用?

How to get the title from a child plugin for use in django-cms admin?

我想将管理员中的插件标题更改为它的标题 children。 我想检查插件是否有 children,如果为真,则显示标题:

我想到了这个:

class ParentClass(CMSPlugin):

def __unicode__(self):
    inner_content = ""
    if ... >= 1:
        for child in children:
            inner_content += child.title
    else:
        inner_content = "empty"
    return unicode(inner_content)

class ChildClass(CMSPlugin):
title = "X"

这样的事情可能吗?

这样的事情怎么样:

class ParentClass(CMSPlugin):

    def __unicode__(self):
        inner_content = ''

        if self.child_plugin_instances is not None:
            for child in self.child_plugin_instances:
                inner_content += child.title

        inner_content = inner_content or "empty" 
        return unicode(inner_content)