I had to index the CMS content in one project, and I get the contents of each placeholder, and the contents of the placeholder are stored in plug-ins attached to it
How to get the contents of a CMSPlugin in a view?
from cms.models import CMSPlugin plugin = CMSPlugin.objects.filter(plugin_type='TextPlugin')[0]
If you want to manage other plugins, such as PicturePlugin , you can get the text "alt", for example:
plugin_picture_content = plugin.get_plugin_instance()[0].alt
How to get CMSPlugin content in a template?
I believe that if you want to get content, we are talking about TextPlugin , you need to be careful, because only the TextPlugin plugin TextPlugin has the body attribute, PicturePlugin has the alt attribute and LinkPlugin has the href attribute, etc.
Solution tailored to your problem.
You run a cycle on placeholders , so you need to get all the plugins for each placeholder and get the contents of each plugin, because the contents of the placeholders, as I mentioned earlier, are stored in the plugins attached to it (TextPlugin, PicturePlugin, LinkPlugin ...).
... ... ... {% for placeholder in item.placeholders.all %}
And so that you only display TextPlugin content, and not other plugins that you could do:
... ... ... {% for placeholder in item.placeholders.all %} # Loop over placeholders {% for plugin in placeholder.get_plugin_list %} # Get plugins for each placeholder {% if 'TextPlugin' in plugin.plugin_type %} {{plugin.get_plugin_instance.0.body|striptags}} {% endif %} {% endfor %} {% endfor %} ... ... ...