You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a simple plugin which display contact people, but I need to exclude some contact on certain pages. So I added a related model to my plugin which use an "structure_to_exclude" ManyToMany relationship. My issue, when I get this variable it's allways empty.
For every plugin you create, there's two versions once you publish.
The public and the draft versions. So its perfectly fine for the ids to change.
Because relationships vary from project to project, anytime your plugin has relationships, you need to explicitly tell the cms how to "copy over" these relationships when publishing the page.
Please adapt your plugin model to have the following method:
I wrote a simple plugin which display contact people, but I need to exclude some contact on certain pages. So I added a related model to my plugin which use an "structure_to_exclude" ManyToMany relationship. My issue, when I get this variable it's allways empty.
The cms_plugins.py
The related model
The Structure Models (Polymorphic !!)
Print results :
Instance : 93
Instance.all() result : []
And When in "editing" mode of django-cms, my code is working...
Instance : 92
Instance.all() result : [ Grammont>, Mayen>, Aï>, ]
Any idea why it's bugy in normal mode and not when in editing ?
The text was updated successfully, but these errors were encountered: