2012-09-07 54 views
3

我在擺弄django-tinyMCE,注意到一些配置沒有得到應用。下面是我的settings.py代碼Django-TinyMCE:如何正確配置它?

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', 
} 

未工作的有: paste_text_sticky,paste_text_sticky_default和valid_styles。

什麼基本上,我試圖做的是:

只允許

  • 文本是 「粗體/斜體/下劃線」
  • 列表(子彈,數量)
  • 鏈接

其他一切都是禁止的。

你知道我在做什麼錯嗎?非常感謝。

回答

6

對於paste_text_stickypaste_text_sticky_default,您需要使用Python True/False。

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', 
} 

看看這Stack Overflow post有關的有效兒童和風格。希望能幫助你。