我安装了Django tiny mce但是我在管理员中获得了正常的文本区域。任何人都可以帮助我将其更正为富文本区域,我可以访问文本格式吗?
这是我的settings.py
import os
PROJECT_DIR = os.path.dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
...
...
...
...
...
...
...
...
...
...
...
...
...
...
TINYMCE_JS_URL = '/media/js/tiny_mce/tiny_mce.js/'
# languages you want to translate into the CMS.
DEFAULT_PAGE_TEMPLATE = 'pages/generic.html'
PAGE_TEMPLATES = (
('pages/generic.html', 'Generic'),
('pages/index.html', 'Home Page'),
('pages/people.html', 'People'),
)
答案 0 :(得分:2)
django-tinymce不会将所有textarea字段替换为TinyMCE编辑器,您必须在模型中使用HTMLField
明确地使用它:
from django.db import models
from tinymce import models as tinymce_models
class MyModel(models.Model):
my_field = tinymce_models.HTMLField()
或者通过替换管理员中的小部件替代第三方应用,如the documentation中所述。
答案 1 :(得分:0)
使用此..我前几天发现它,它是一个非常好的分步教程,在django管理员中使用tinymce
答案 2 :(得分:0)
谢谢你的回答是非常有效的,我不认为我正确地表达了我的问题,尽管我的错是我是django的新手。我正在使用带有django page cms占位符的tinymce。
问题是我的settings.py它需要以正确的方式配置。小问题......
可以通过编辑项目的settings.py文件来配置应用程序。
TINYMCE_JS_URL (default: settings.MEDIA_URL + 'js/tiny_mce/tiny_mce.js')
The URL of the TinyMCE javascript file.
TINYMCE_JS_ROOT (default: settings.MEDIA_ROOT + 'js/tiny_mce')
The filesystem location of the TinyMCE files.
TINYMCE_DEFAULT_CONFIG (default: {'theme': "simple", 'relative_urls': False})
The default TinyMCE configuration to use. See the TinyMCE manual for all options. To set the configuration for a specific TinyMCE editor, see the mce_attrs parameter for the widget.
TINYMCE_SPELLCHECKER (default: False)
Whether to use the spell checker through the supplied view. You must add spellchecker to the TinyMCE plugin list yourself, it is not added automatically.
TINYMCE_COMPRESSOR (default: False)
Whether to use the TinyMCE compressor, which gzips all Javascript files into a single stream. This makes the overall download size 75% smaller and also reduces the number of requests. The overall initialization time for TinyMCE will be reduced dramatically if you use this option.
TINYMCE_FILEBROWSER (default: True if 'filebrowser' is in INSTALLED_APPS, else False)
Whether to use django-filebrowser as a custom filebrowser for media inclusion. See the official TinyMCE documentation on custom filebrowsers.
Example:
TINYMCE_JS_URL = 'http://debug.example.org/tiny_mce/tiny_mce_src.js'
TINYMCE_DEFAULT_CONFIG = {
'plugins': "table,spellchecker,paste,searchreplace",
'theme': "advanced",
}
TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True
取自。 http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build/html/installation.html