python
# settings.py
INSTALLED_APPS = [
...
'cms',
'djedi-cms',
...
]
CMS_TEMPLATES = [
('template1.html', 'Template 1'),
('template2.html', 'Template 2'),
]
# models.py
from cms.models import Page
from django.db import models
class CMSPage(Page):
some_field = models.CharField(max_length=100)
# plugins.py
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
class TextPlugin(CMSPluginBase):
model = TextPluginModel
render_template = "text_plugin.html"
cache = False
def render(self, context, instance, placeholder):
context = super().render(context, instance, placeholder)
return context
plugin_pool.register_plugin(TextPlugin)