我想在我的 Django 项目中使用 TinyMCE,在完成所有必要的设置后,当我访问页面时,表单只呈现普通的 django 表单,而不是 TinyMCE 富文本表单。下面是我的设置。
我将tinymce文件夹复制到媒体文件夹:
C:/Python27/Scripts/nate/media/js/tiny_mce
设置.py
TINYMCE_JS_URL = '/media/js/tiny_mce/tiny_mce.js/'
TINYMCE_DEFAULT_CONFIG = {
'plugins': "table,spellchecker,paste,searchreplace",
'theme': "advanced",
'cleanup_on_startup': True,
'custom_undo_redo_levels': 10,
}
TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True
网址.py
(r'^tinymce/', include('tinymce.urls')),
楷模
class Finmall(models.Model):
user=models.ForeignKey(User)
name=models.CharField(max_length=250, unique=True)
content1 = models.TextField()
content2 = models.TextField()
def __unicode__(self):
return self.user
模板
<head>
<script type="text/javascript" src="{{ MEDIA_URL }}/js/tiny_mce/tiny_mce.js"></script>
</script>
</head>
{% block content %}
<div id="postcribbody" class="wrapper">
<p class="list">You can make it</p>
<form enctype="multipart/form-data" form action="." method="POST">
{% csrf_token %}
{{ FinmallForm.as_p }}
<input type="submit" class="cribput" value="Submit"/>
</form>
</div>
{% endblock %}
如何让 content1 和 content2 显示 TinyMCE 富文本格式?