0
我想爲我的django項目使用tinymce,但它不工作。 我使用「pip install django-tinymce」來安裝它,我試圖使用如果爲管理員更改表單模板。請找到下面的代碼。Tinymce不工作
chanage-form.html
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{{ media }}
<script >
define(['jquery', 'tiny_mce/jquery.tinymce'], function ($) {
$('textarea').tinymce({
script_url : 'js/tiny_mce/tiny_mce.js',
theme : 'advanced',
theme_advanced_buttons1 : 'fontselect,fontsizeselect,forecolor,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,removeformat,indent,outdent,numlist,bullist,copy,paste,link',
theme_advanced_buttons2 : '',
theme_advanced_buttons3 : '',
theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left'
});
});
</script>
<script type="text/javascript" src="/tinymce/static/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
theme: "simple"
});
</script>
urls.py
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
(r'^tinymce/', include('tinymce.urls')),
url(r'', include('django.contrib.flatpages.urls')),
)