{"action":"created","issue":{"url":"https://api.github.com/repos/divio/django-cms/issues/5001","repository_url":"https://api.github.com/repos/divio/django-cms","labels_url":"https://api.github.com/repos/divio/django-cms/issues/5001/labels{/name}","comments_url":"https://api.github.com/repos/divio/django-cms/issues/5001/comments","events_url":"https://api.github.com/repos/divio/django-cms/issues/5001/events","html_url":"https://github.com/divio/django-cms/issues/5001","id":133320416,"number":5001,"title":"Issue when publishing content from custom plugin w/ parent/child","user":{"login":"scottrogers","id":1859538,"avatar_url":"https://avatars.githubusercontent.com/u/1859538?v=3","gravatar_id":"","url":"https://api.github.com/users/scottrogers","html_url":"https://github.com/scottrogers","followers_url":"https://api.github.com/users/scottrogers/followers","following_url":"https://api.github.com/users/scottrogers/following{/other_user}","gists_url":"https://api.github.com/users/scottrogers/gists{/gist_id}","starred_url":"https://api.github.com/users/scottrogers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottrogers/subscriptions","organizations_url":"https://api.github.com/users/scottrogers/orgs","repos_url":"https://api.github.com/users/scottrogers/repos","events_url":"https://api.github.com/users/scottrogers/events{/privacy}","received_events_url":"https://api.github.com/users/scottrogers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-12T19:15:33Z","updated_at":"2016-05-17T18:02:35Z","closed_at":null,"body":"I have created 2 plugins:\r\n```\r\nclass CarouselPlugin(CMSPluginBase):\r\n    model = Carousel\r\n    name = (\"Carousel\")\r\n    render_template = \"carousel.html\"\r\n    cache = True\r\n    allow_children = True\r\n\r\n    def render(self, context, instance, placeholder):\r\n        context = super(CarouselPlugin, self).render(context, instance, placeholder)\r\n        return context\r\n\r\nplugin_pool.register_plugin(CarouselPlugin)\r\n\r\n\r\nclass SlidePlugin(CMSPluginBase):\r\n    model = Slide\r\n    name = ('Slide')\r\n    render_template = \"slide.html\"\r\n    change_form_template = \"change_form.html\"\r\n    cache = True\r\n    parent_classes = ('TextPlugin', 'CarouselPlugin')\r\n\r\n    def render(self, context, instance, placeholder):\r\n\r\n        context = super(SlidePlugin, self).render(context, instance, placeholder)\r\n        return context\r\n\r\n\r\nplugin_pool.register_plugin(SlidePlugin)\r\n```\r\nThe data comes from these models:\r\n\r\n```\r\nfrom cms.models.pluginmodel import CMSPlugin\r\n\r\nclass Carousel(CMSPlugin):\r\n    title = models.CharField(blank=True, max_length=100)\r\n    slug = models.SlugField()\r\n    height = models.IntegerField(blank=True, null=True)\r\n\r\n    def __unicode__(self):\r\n        return self.title\r\n\r\nclass Slide(CMSPlugin):\r\n    BACKGROUND_POSITIONS = (\r\n        (u'top', u'top'),\r\n        (u'center', u'center'),\r\n        (u'bottom', u'bottom'),\r\n    )\r\n    image = models.ImageField(upload_to=\"carousel/\")\r\n    image_position = models.CharField(blank=True, max_length=100, choices=BACKGROUND_POSITIONS)\r\n    content = models.TextField()\r\n    order = models.PositiveIntegerField(default=0, blank=False, null=False)\r\n    carousel = models.ForeignKey('Carousel')\r\n    slug = models.SlugField()\r\n\r\n\r\n    def __unicode__(self):\r\n        return self.content\r\n\r\n    class Meta:\r\n        ordering = ('order',)\r\n\r\n    def image_tag(self):\r\n        return u'<img src=\"' + settings.MEDIA_URL + '%s\" width=\"50\" height=\"auto\"/>' % self.image\r\n\r\n    image_tag.short_description = 'Slide'\r\n    image_tag.allow_tags = True\r\n```\r\n\r\n1. I can create content and view it when it's in edit mode, but when publishing the content, I get a 500 error.\r\n2. I can publish the parent plugin, CarouselPlugin (when it doesnt have a child plugin in it).\r\n3. When I add a Slide (child to parent plugin), and try to publish that, I get the following error:\r\n![screenshot 2016-02-12 11 07 15](https://cloud.githubusercontent.com/assets/1859538/13017425/fe538646-d178-11e5-843b-ce4c43ca7fa0.png)\r\n\r\nUsing django-cms==3.2.0\r\n\r\nAny help would be great!"},"comment":{"url":"https://api.github.com/repos/divio/django-cms/issues/comments/219802416","html_url":"https://github.com/divio/django-cms/issues/5001#issuecomment-219802416","issue_url":"https://api.github.com/repos/divio/django-cms/issues/5001","id":219802416,"user":{"login":"czpython","id":994951,"avatar_url":"https://avatars.githubusercontent.com/u/994951?v=3","gravatar_id":"","url":"https://api.github.com/users/czpython","html_url":"https://github.com/czpython","followers_url":"https://api.github.com/users/czpython/followers","following_url":"https://api.github.com/users/czpython/following{/other_user}","gists_url":"https://api.github.com/users/czpython/gists{/gist_id}","starred_url":"https://api.github.com/users/czpython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czpython/subscriptions","organizations_url":"https://api.github.com/users/czpython/orgs","repos_url":"https://api.github.com/users/czpython/repos","events_url":"https://api.github.com/users/czpython/events{/privacy}","received_events_url":"https://api.github.com/users/czpython/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T18:02:35Z","updated_at":"2016-05-17T18:02:35Z","body":"@scottrogers \r\nThe problem is that plugins already have an ordering specified.\r\nInternally there's a field called ``position`` for all plugins, this field along with the path field determine the order of your plugin within the tree and inside a placeholder.\r\n\r\nPlease remove the ``order `` field and the ``ordering`` from the meta class.\r\nThen run ``python manage.py cms fix-tree`` to fix the plugin positions.\r\nMake sure to backup db just in case given that this command recalculates the plugin positions\r\n\r\nAlso please upgrade to the latest 3.2.x release as some bugs with fix-tree and the tree were fixed."}}