Django-cms: Published Plugin not visible in edit view

Created on 24 Mar 2017  路  7Comments  路  Source: django-cms/django-cms

Summary

I've gotten into a situation where I have a plugins (instances of djangocms_text_ckeditor.text, and cmsplugin_contact_plus.contactplus) which are visible on a published page, but when I click edit, they are not on the draft page. When I publish that draft, they are again on the published page. So I have no way in the front end to edit or remove them.

I found the PKs by inspecting the output from ./manage.py dumpdata and used the shell to delete the contactplus instance. Which did get it removed from the page.

Expected behaviour

Editing a page allows access to all placeholders

Actual behaviour

Some published placeholders do not appear in the draft page.

Environment

  • Python version: 2.7.12, 2.7.3
  • Django version: Django==1.9.3
  • django CMS version: django-cms==3.2.5

Steps to reproduce

I'm not sure, but I've done a couple edge-casey things.

  1. Quite a bit of dumpdata/loaddata, but I usually reset the tables before loaddata and always cms moderator on after. Without flushing the tables, I'll end up with duplicate placeholders on every page that's had changes. I do this to keep content in sync between 2 local dev environments, and one deployed test instance.

  2. The page that's having problems has been around for a long time. We've migrated up from django 1.3, and we're going through a front end redesign. So the template used for the page has had the placeholder names rearranged quite a bit. It's possible that the page was saved without the containing placeholder, and then it was later added back in.

Most helpful comment

Hey, I think I know why this is happening.
The problem appears when a pluginModel inerhits from another plugin model so that it's not inerhiting from the CMSPlugin (cms.models.pluginmodel)

Like:
class BasePluginModel(CMSPlugin)
class ExtendBasePluginModel(BasePluginModel)

the second Plugin will not appear in edit mode.

I changed the ExtendBasePluginModel to inerhiz from CMSPlugin and the Plugin appears now.

I hope that this will help people with the same problem.
Sorry for my bad english :P

All 7 comments

Hello @aarcro , django CMS itself currently does not support loaddata/dumpdata as it can lead to a lot of tree corruptions.

As a result, I believe your issue is best in the [Users Mailing List (https://groups.google.com/forum/#!forum/django-cms).

I suggest running the ./manage.py cms fix-tree command to make sure your tree is in good condition.

I've run fix-tree, but it didn't help. The issue seemed localized to me, but @evildmp asked me to open the ticket in IRC.

Hey @aarcro ,
I run into exact the same problem. I am also convinced it has something to do with localization. Did you solved the issue? Can you contact me please -> [email protected] or just answer here :) Thanks!!

@maj0rr Haven't touched this in a long time. There wasn't a good solution, other than using the dumpdata output to clean up the orphans. Sorry

Hey, I think I know why this is happening.
The problem appears when a pluginModel inerhits from another plugin model so that it's not inerhiting from the CMSPlugin (cms.models.pluginmodel)

Like:
class BasePluginModel(CMSPlugin)
class ExtendBasePluginModel(BasePluginModel)

the second Plugin will not appear in edit mode.

I changed the ExtendBasePluginModel to inerhiz from CMSPlugin and the Plugin appears now.

I hope that this will help people with the same problem.
Sorry for my bad english :P

I changed the ExtendBasePluginModel to inerhiz from CMSPlugin and the Plugin appears now.

But then you are loosing all functionality of the BasePluginModel... what if I WANT to inherit from BasePluginModel?
Anyone a solution?

I have received a project with the same problem :(

And it's the problem of wrong CMSPlugin model inerhits described by @maj0rr This will cause missing database fields.

IMHO django CMS should be have checks that this wrong inerhit will be not possible, isn't it?

Was this page helpful?
0 / 5 - 0 ratings