Mike Waites
Mike Waites

Reputation: 1728

Use django text plugin for model fields in custom plugin

Hi this is a long shot i think but here goes.....

Basically i have a few custom plugins and apps being used in my django /django-cms site. I have set tinymce up which is working fairly ok however what im wondering is it possible to use the built in text plugin for the TextField model fields in my custom plugins and apps?

so in effect the info text field for my main content plugin would actually render in the admin site as the text plugin

Like i said i think this is a long shot...

Upvotes: 3

Views: 2025

Answers (2)

Johannes
Johannes

Reputation: 514

I also had this requirement (formatted text on a django-cms plugin configuration) and ended up with the following workaround: I installed django-tinymce and changed my TextField to an HTMLField in the CMS plugin configuration model. This will render a tinymce text editor in the plugin configuration form. You can then use the input from the HTMLField in your plugin template with the ...|safe filter.

Upvotes: 0

ojii
ojii

Reputation: 4781

You cannot use single-plugins on models, however you can define PlaceholderFields on your custom models to put cms plugins in. So you can define a PlaceholderField, put a TextPlugin inside that placeholder and do whatever you want.

For more information, read the official documentation about this http://docs.django-cms.org/en/2.1.3/extending_cms/placeholders.html

Upvotes: 0

Related Questions