在自定义插件中使用 django 文本插件作为模型字段
嗨,我认为这是一个漫长的过程,但这里......
基本上我在我的 django /django-cms 站点中使用了一些自定义插件和应用程序。我已经设置了tinymce,它工作得相当好,但是我想知道是否可以在我的自定义插件和应用程序中使用内置文本插件作为 TextField 模型字段?
因此,实际上我的主要内容插件的信息文本字段实际上会在管理站点中呈现为文本插件
就像我说的,我认为这是一个长期的机会......
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能在模型上使用单个插件,但是您可以在自定义模型上定义
PlaceholderFields
来放入 cms 插件。因此,您可以定义一个 PlaceholderField,在该占位符中放置一个 TextPlugin 并执行您想要的任何操作。有关更多信息,请阅读有关此的官方文档 http://docs .django-cms.org/en/2.1.3/extending_cms/placeholders.html
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
我也有这个要求(django-cms 插件配置上的格式化文本)并最终得到了以下解决方法:
我安装了 django-tinymce 并将我的 TextField 更改为 CMS 插件配置模型中的 HTMLField。这将在插件配置表单中呈现一个tinymce文本编辑器。然后,您可以将插件模板中 HTMLField 的输入与
...|safe
过滤器结合使用。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.