2010-09-13 16 views
2

我安装了Django tiny mce,但是我在我的管理员中获得了正常的文本区域。任何人都可以帮我纠正这一问题,我可以使用文本格式化的富文本区域?django tiny mce是普通文本字段而不是富文本格式?请修复。设置包括

这里是我的settings.py

import os 
PROJECT_DIR = os.path.dirname(__file__) 

DEBUG = True 
TEMPLATE_DEBUG = DEBUG 

ADMINS = (
    # ('Your Name', '[email protected]'), 
) 

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

) 

回答

2

Django的TinyMCE的不更换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中所述。

+0

干杯,这是正确的。 – Stu 2010-09-23 08:11:56

0

感谢您的回答是非常有效的,我不我认为我没有正确地表达我的问题,尽管我的错我是django的新手。我使用django页面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

相关问题