[Answered ]-Django CMS custom plugin Error

2👍

I had the same problem, now I solved it successfully
just focus on simple steps to implement RichTextBox in Django-cms using (favorite editor) ckeditor:

models.py

from djangocms_text_ckeditor.models import AbstractText
class TipSlide(AbstractText):
    pass

cms_plugins.py

from djangocms_text_ckeditor.cms_plugins import TextPlugin
from models import SlideModel, TipSlide
class TipSlidePlugin(TextPlugin):
    name = u'Tip Slide Ads'
    model = TipSlide
    render_template = "slide/tipslide.html"

plugin_pool.register_plugin(TipSlidePlugin)

tipslide.html

<div>
    <div class="container">
        {{ body|safe }}<!-- The simple plugin -->
    </div>
</div>

the result is:
enter image description here

0👍

I think you have to do this because you dont pass the Description instance inside in the context instance.descriptontoinstance

def render(self,context,instance,placeholder):
    print "contexttttttttttttttttttttttttttt"
    context.update({
                   'instance': instance,
                   'object':instance,
                   'placeholder': placeholder,
                   })
    return context
👤Azd325

0👍

You cannot name your model fields the same as any installed plugins lower- cased model name, due to the implicit one-to-one relation Django uses for subclassed models.

See warning end of “3.5.Storing configuration” section:

http://docs.django-cms.org/en/3.0.1/extending_cms/custom_plugins.html#storing-configuration

Leave a comment