【发布时间】:2016-04-04 21:55:38
【问题描述】:
Python 3
Django 1.9
Django-CMS 3.2.2
我有这样的事情:
models.py
class PluginModel(CMSPlugin):
title = models.CharField(max_length=60)
class InlineModel(models.Model):
title = models.CharField(max_length=60)
plugin_key = models.ForeignKey('PluginModel' related_name='breakpoints')
cms_plugins.py
class InlineModelInline(admin.StackedInline):
model = InlineModel
class PluginModelPlugin(CMSPluginBase):
model = PluginModel
inlines = [InlineModelInline,]
def render(self, context, instance, placeholder):
context = super(CarouselPlugin, self).render(context, instance, placeholder)
print(instance.breakpoints.all()) #for simple debug
我添加了一些内联然后保存。在编辑中,所有内联显示正常,但如果我发布页面,则只返回一个空列表。我知道这是发布系统的故障,但我怎样才能让它工作呢?
【问题讨论】:
-
对吗
context = super(CarouselPlugin, self)? -
这很有趣,我进入文档向您展示这是真的,并且偶然发现那里与您的问题相对应。
标签: python django django-cms