【发布时间】:2015-10-21 02:47:44
【问题描述】:
我正在尝试提供自定义 djangocms-text-ckeditor 配置,以减少 Django-CMS 3.0.13 项目中富文本插件中可用选项的数量。
根据documentation,我正在扩展模型和CMSPlugin:
# models.py
class WysiwygText(AbstractText):
def __unicode__(self):
return truncatechars(truncatewords_html(self.content, 10), 20)
@property
def name(self):
return self
# cms_plugins.py
WYSIWYG_CKEDITOR_CONFIGURATION = {
'language': 'en',
'toolbar_CMS': [
['cmsplugins', '-', 'Bold', 'Italic', 'BulletedList'],
['Undo', 'Redo'],
],
'skin': 'moono',
'toolbarCanCollapse': False,
}
class WysiwygPlugin(TextPlugin):
admin_preview = False
ckeditor_configuration = WYSIWYG_CKEDITOR_CONFIGURATION
model = WysiwygText
name = _('WYSIWYG Text')
当我尝试编辑这个插件时,我得到:
TypeError 在 /en/admin/cms/page/edit-plugin/58/ getattr(): 属性名必须是字符串
完整的例外在这里:https://gist.github.com/alsoicode/cae2c4cc0824c34ed208
我做错了什么?
【问题讨论】:
-
感谢 downvoter,提醒我,当您在 Stack Overflow 上累得要死时,没有地方可以犯愚蠢的错误。
标签: django django-cms djangocms-text-ckeditor