Django-TinyMCE:如何正确配置?

Jos*_*nel 4 django tinymce django-forms

我正在摆弄django-tinyMCE并注意到一些配置没有得到应用.这是我的settings.py中的代码

TINYMCE_DEFAULT_CONFIG = {
    'theme' : 'advanced',
    'theme_advanced_buttons1' : 'bold,italic,underline,separator,bullist,numlist,separator,link,unlink',
    'theme_advanced_buttons2' : '',
    'theme_advanced_buttons3' : '',
    'theme_advanced_toolbar_location' : 'top',
    'theme_advanced_toolbar_align': 'left',
    'paste_text_sticky': 'true',
    'paste_text_sticky_default' : 'true',
    'valid_styles' : 'font-weight,font-style,text-decoration',
}
Run Code Online (Sandbox Code Playgroud)

那些不起作用的是:paste_text_sticky,paste_text_sticky_default和valid_styles.

我基本上要做的是:

只允许

  • 文字是"粗体/斜体/下划线"
  • 清单(子弹,数字)
  • 链接

其他一切都是被禁止的.

你知道我做错了什么吗?非常感谢.

Bra*_*don 7

您需要使用Python True/False for paste_text_stickypaste_text_sticky_default.

TINYMCE_DEFAULT_CONFIG = {
    'theme' : 'advanced',
    'theme_advanced_buttons1' : 'bold,italic,underline,separator,bullist,numlist,separator,link,unlink',
    'theme_advanced_buttons2' : '',
    'theme_advanced_buttons3' : '',
    'theme_advanced_toolbar_location' : 'top',
    'theme_advanced_toolbar_align': 'left',
    'paste_text_sticky': True,
    'paste_text_sticky_default' : True,
    'valid_styles' : 'font-weight,font-style,text-decoration',
}
Run Code Online (Sandbox Code Playgroud)

看一下与有效子项和样式相关的Stack Overflow帖子.希望能帮到你.