django-wysiwyg-编辑器在Django 1.8上的工作遇到了麻烦。我需要使工具栏固定在管理网站,但RedactorField不应用任何设置,我试图使用。管理网站使用django-grappelli 2.7.3。
我尝试了所有在文档中解释的内容,但是即使在最简单的设置“maxWidth”:“100 in”上,我也没有更改我的管理站点:
1)在settings.py上编写设置,如这里所解释的,在这里输入链接描述
REDACTOR_OPTIONS = {'maxWidth': '100px'}2)在模型定义中使用RedactorField at models.py (也如docs示例所示):
announce = RedactorField(redactor_options={'maxWidth': '150px'})(我也尝试使用redactor_settings,因为它在源代码中而不是redactor_options中,但是它抛出和错误'init()获得了一个意外的关键字参数‘redactor_redactor_options’‘)
3)使用RedactorEditor at my forms.py作为小部件:
# this raises '_init_() got unexpected word' exception because of redactor_settings
announce = forms.CharField(widget=RedactorEditor(redactor_settings={'maxWidth': '100px'}))(我也尝试使用redactor_settings,因为它在源代码中而不是redactor_options中,但是它抛出和错误'init()获得了一个意外的关键字参数‘redactor_redactor_options’‘)
但他们中的任何一个都不起作用。我会感谢你的帮助!我没有足够的信息,我可以显示更多的源代码。
发布于 2017-01-19 11:59:31
我找到解决办法了!问题是我在settings.py文件中使用了不正确的设置格式。这是正确的(对于我想要的固定工具栏):
REDACTOR_OPTIONS = {
'lang': 'en',
'toolbarFixedTopOffset': 70,
}https://stackoverflow.com/questions/41690618
复制相似问题