[Answer]-Django CMS place holder is not displaying

1👍

I believe your issue here is that you’re trying to create a placeholder as a CMSPlugin. Plugins sit within a placeholder but I’ve never seen a plugin contain a placeholder.

What you’re then trying to do I assume is to have a placeholder on a base template which is set to display your TabItem plugin which in turn is intended to render another placeholder.

I’ve not written this up, but I believe what you should be doing is something like this;

models.py;

from django.db import models

from cms.models import CMSPlugin
from cms.models.fields import PlaceholderField


class TabItem(models.Model):
    tab_name = models.CharField(max_length=8)
    placeholder = PlaceholderField("place_holder_name")


class TabPlugin(CMSPlugin):
    tab_name = models.CharField(max_length=8)

admin.py;

from django.contrib import admin

from cms.admin.placeholderadmin import PlaceholderAdmin

from .models import TabItem


class TabItemAdmin(PlaceholderAdmin):
    pass

admin.site.register(TabItem, TabItemAdmin)

From that you can add your custom placeholder to a template which in turn renders your plugin. At least that is my understanding from the docs – Placeholders outside the CMS

Leave a comment