0
Django-CMS 문서 (http://docs.django-cms.org/en/2.3.5/extending_cms/custom_plugins.html)에서 2.4의 예제를 복제하려고합니다. 그러나 cms_plugins.pyclass HelloPlugin
에서 모델을 지정할 때마다 관리자의 전체 CMS 섹션이 사라집니다. 이 문제의 원인은 무엇입니까?Django-CMS - 모델을 지정하면 admin의 CMS 섹션이 사라집니다.
models.py
from django.db import models
class MyModel(models.Model):
title = models.CharField(max_length=50, null=True, blank=True)
def __unicode__(self):
return self.title
from cms.models.pluginmodel import CMSPlugin
class HelloPlugin(CMSPlugin):
ad = models.ForeignKey('core.MyModel', related_name='plugins')
def __unicode__(self):
return self.ad.title
cms_plugins.py
class HelloPlugin(CMSPluginBase):
model = MyModel
name = _("MyModel Plugin")
render_template = "myplugin.html"
def render(self, context, instance, placeholder):
context['instance'] = instance
return context
plugin_pool.register_plugin(HelloPlugin)