2010-09-13 44 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

相關問題